1console.warn(
'Scripts "build/three.js" and "build/three.min.js" are deprecated with r150+, and will be removed with r160. Please use ES Modules or alternatives: https://threejs.org/docs/index.html#manual/en/introduction/Installation' );
11})(
this, (
function (
exports) {
'use strict';
224 const GLSL3 =
'300 es';
278 if (
index !== - 1 ) {
316 const _lut = [
'00',
'01',
'02',
'03',
'04',
'05',
'06',
'07',
'08',
'09',
'0a',
'0b',
'0c',
'0d',
'0e',
'0f',
'10',
'11',
'12',
'13',
'14',
'15',
'16',
'17',
'18',
'19',
'1a',
'1b',
'1c',
'1d',
'1e',
'1f',
'20',
'21',
'22',
'23',
'24',
'25',
'26',
'27',
'28',
'29',
'2a',
'2b',
'2c',
'2d',
'2e',
'2f',
'30',
'31',
'32',
'33',
'34',
'35',
'36',
'37',
'38',
'39',
'3a',
'3b',
'3c',
'3d',
'3e',
'3f',
'40',
'41',
'42',
'43',
'44',
'45',
'46',
'47',
'48',
'49',
'4a',
'4b',
'4c',
'4d',
'4e',
'4f',
'50',
'51',
'52',
'53',
'54',
'55',
'56',
'57',
'58',
'59',
'5a',
'5b',
'5c',
'5d',
'5e',
'5f',
'60',
'61',
'62',
'63',
'64',
'65',
'66',
'67',
'68',
'69',
'6a',
'6b',
'6c',
'6d',
'6e',
'6f',
'70',
'71',
'72',
'73',
'74',
'75',
'76',
'77',
'78',
'79',
'7a',
'7b',
'7c',
'7d',
'7e',
'7f',
'80',
'81',
'82',
'83',
'84',
'85',
'86',
'87',
'88',
'89',
'8a',
'8b',
'8c',
'8d',
'8e',
'8f',
'90',
'91',
'92',
'93',
'94',
'95',
'96',
'97',
'98',
'99',
'9a',
'9b',
'9c',
'9d',
'9e',
'9f',
'a0',
'a1',
'a2',
'a3',
'a4',
'a5',
'a6',
'a7',
'a8',
'a9',
'aa',
'ab',
'ac',
'ad',
'ae',
'af',
'b0',
'b1',
'b2',
'b3',
'b4',
'b5',
'b6',
'b7',
'b8',
'b9',
'ba',
'bb',
'bc',
'bd',
'be',
'bf',
'c0',
'c1',
'c2',
'c3',
'c4',
'c5',
'c6',
'c7',
'c8',
'c9',
'ca',
'cb',
'cc',
'cd',
'ce',
'cf',
'd0',
'd1',
'd2',
'd3',
'd4',
'd5',
'd6',
'd7',
'd8',
'd9',
'da',
'db',
'dc',
'dd',
'de',
'df',
'e0',
'e1',
'e2',
'e3',
'e4',
'e5',
'e6',
'e7',
'e8',
'e9',
'ea',
'eb',
'ec',
'ed',
'ee',
'ef',
'f0',
'f1',
'f2',
'f3',
'f4',
'f5',
'f6',
'f7',
'f8',
'f9',
'fa',
'fb',
'fc',
'fd',
'fe',
'ff' ];
327 const d0 =
Math.random() * 0xffffffff | 0;
328 const d1 =
Math.random() * 0xffffffff | 0;
329 const d2 =
Math.random() * 0xffffffff | 0;
330 const d3 =
Math.random() * 0xffffffff | 0;
337 return uuid.toLowerCase();
351 return ( (
n %
m ) + m ) %
m;
380 return ( 1 -
t ) *
x +
t *
y;
401 if (
x <=
min )
return 0;
402 if (
x >=
max )
return 1;
406 return x *
x * ( 3 - 2 *
x );
412 if (
x <=
min )
return 0;
413 if (
x >=
max )
return 1;
417 return x *
x *
x * (
x * (
x * 6 - 15 ) + 10 );
451 t =
Math.imul(
t ^
t >>> 15,
t | 1 );
453 t ^=
t +
Math.imul(
t ^
t >>> 7,
t | 61 );
455 return ( (
t ^
t >>> 14 ) >>> 0 ) / 4294967296;
539 console.warn(
'THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: ' +
order );
547 switch (
array.constructor ) {
555 return value / 4294967295.0;
559 return value / 65535.0;
563 return value / 255.0;
567 return Math.max(
value / 2147483647.0, - 1.0 );
571 return Math.max(
value / 32767.0, - 1.0 );
579 throw new Error(
'Invalid component type.' );
587 switch (
array.constructor ) {
595 return Math.round(
value * 4294967295.0 );
607 return Math.round(
value * 2147483647.0 );
619 throw new Error(
'Invalid component type.' );
656 Vector2.prototype.isVector2 =
true;
725 case 0: this.
x =
value;
break;
726 case 1: this.
y =
value;
break;
727 default:
throw new Error(
'index is out of range: ' +
index );
739 case 0:
return this.
x;
740 case 1:
return this.
y;
741 default:
throw new Error(
'index is out of range: ' +
index );
860 const x = this.
x,
y = this.
y;
861 const e =
m.elements;
863 this.
x =
e[ 0 ] *
x +
e[ 3 ] * y +
e[ 6 ];
864 this.y =
e[ 1 ] *
x +
e[ 4 ] *
y +
e[ 7 ];
872 this.
x =
Math.min( this.
x,
v.x );
873 this.
y =
Math.min( this.
y,
v.y );
881 this.
x =
Math.max( this.
x,
v.x );
882 this.
y =
Math.max( this.
y,
v.y );
918 this.
x =
Math.floor( this.
x );
919 this.
y =
Math.floor( this.
y );
927 this.
x =
Math.ceil( this.
x );
928 this.
y =
Math.ceil( this.
y );
936 this.
x =
Math.round( this.
x );
937 this.
y =
Math.round( this.
y );
945 this.
x =
Math.trunc( this.
x );
946 this.
y =
Math.trunc( this.
y );
963 return this.
x *
v.x + this.
y *
v.y;
969 return this.
x *
v.y - this.
y *
v.x;
975 return this.
x * this.
x + this.
y * this.
y;
981 return Math.sqrt( this.
x * this.
x + this.
y * this.
y );
987 return Math.abs( this.
x ) +
Math.abs( this.
y );
1029 const dx = this.
x -
v.x,
dy = this.
y -
v.y;
1036 return Math.abs( this.
x -
v.x ) +
Math.abs( this.
y -
v.y );
1048 this.
x += (
v.x - this.
x ) *
alpha;
1049 this.
y += (
v.y - this.
y ) *
alpha;
1066 return ( (
v.x ===
this.x ) && (
v.y ===
this.y ) );
1113 this.
x =
Math.random();
1114 this.
y =
Math.random();
1133 Matrix3.prototype.isMatrix3 =
true;
1180 const me =
m.elements;
1182 te[ 0 ] =
me[ 0 ];
te[ 1 ] =
me[ 1 ];
te[ 2 ] =
me[ 2 ];
1183 te[ 3 ] =
me[ 3 ];
te[ 4 ] =
me[ 4 ];
te[ 5 ] =
me[ 5 ];
1184 te[ 6 ] =
me[ 6 ];
te[ 7 ] =
me[ 7 ];
te[ 8 ] =
me[ 8 ];
1192 xAxis.setFromMatrix3Column(
this, 0 );
1193 yAxis.setFromMatrix3Column(
this, 1 );
1194 zAxis.setFromMatrix3Column(
this, 2 );
1202 const me =
m.elements;
1206 me[ 0 ],
me[ 4 ], me[ 8 ],
1207 me[ 1 ],
me[ 5 ],
me[ 9 ],
1208 me[ 2 ],
me[ 6 ],
me[ 10 ]
1230 const ae =
a.elements;
1231 const be =
b.elements;
1262 te[ 0 ] *=
s;
te[ 3 ] *=
s;
te[ 6 ] *=
s;
1263 te[ 1 ] *=
s;
te[ 4 ] *=
s;
te[ 7 ] *=
s;
1264 te[ 2 ] *=
s;
te[ 5 ] *=
s;
te[ 8 ] *=
s;
1274 const a =
te[ 0 ],
b =
te[ 1 ],
c =
te[ 2 ],
1296 if (
det === 0 )
return this.
set( 0, 0, 0, 0, 0, 0, 0, 0, 0 );
1321 tmp =
m[ 1 ];
m[ 1 ] =
m[ 3 ];
m[ 3 ] =
tmp;
1398 if (
x.isVector2 ) {
1464 for (
let i = 0;
i < 9;
i ++ ) {
1466 if (
te[
i ] !==
me[
i ] )
return false;
1476 for (
let i = 0;
i < 9;
i ++ ) {
1522 if (
array[
i ] >= 65535 )
return true;
1550 return document.createElementNS(
'http://www.w3.org/1999/xhtml',
name );
1557 canvas.style.display =
'block';
1587 0.8224621, 0.177538, 0.0,
1588 0.0331941, 0.9668058, 0.0,
1589 0.0170827, 0.0723974, 0.9105199,
1593 1.2249401, - 0.2249404, 0.0,
1594 - 0.0420569, 1.0420571, 0.0,
1595 - 0.0196376, - 0.0786361, 1.0982735
1701 return (
c < 0.04045 ) ?
c * 0.0773993808 :
Math.pow(
c * 0.9478672986 + 0.0521327014, 2.4 );
1707 return (
c < 0.0031308 ) ?
c * 12.92 : 1.055 * (
Math.pow(
c, 0.41666 ) ) - 0.055;
1742 const context =
_canvas.getContext(
'2d' );
1746 context.putImageData(
image, 0, 0 );
1760 console.warn(
'THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons',
image );
1762 return canvas.toDataURL(
'image/jpeg', 0.6 );
1766 return canvas.toDataURL(
'image/png' );
1783 const context =
canvas.getContext(
'2d' );
1795 context.putImageData(
imageData, 0, 0 );
1799 }
else if (
image.data ) {
1827 console.warn(
'THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied.' );
1844 Object.defineProperty(
this,
'id', {
value: _sourceId ++ } );
1877 if (
data !==
null ) {
1945 type:
image.data.constructor.name
1950 console.warn(
'THREE.Texture: Unable to serialize Texture.' );
1969 Object.defineProperty(
this,
'id', {
value: _textureId ++ } );
1989 this.format = format;
2012 warnOnce(
'THREE.Texture: Property .encoding has been replaced by .colorSpace.' );
2042 this.
matrix.setUvTransform( this.
offset.x,
this.offset.y,
this.repeat.x,
this.repeat.y,
this.rotation,
this.center.x,
this.center.y );
2070 this.format =
source.format;
2129 format: this.format,
2146 if (
Object.keys(
this.userData ).length > 0 )
output.userData =
this.userData;
2170 if (
uv.x < 0 ||
uv.x > 1 ) {
2172 switch ( this.
wrapS ) {
2181 uv.x =
uv.x < 0 ? 0 : 1;
2186 if (
Math.abs(
Math.floor(
uv.x ) % 2 ) === 1 ) {
2202 if (
uv.y < 0 ||
uv.y > 1 ) {
2204 switch ( this.
wrapT ) {
2213 uv.y =
uv.y < 0 ? 0 : 1;
2218 if (
Math.abs(
Math.floor(
uv.y ) % 2 ) === 1 ) {
2246 if (
value ===
true ) {
2249 this.
source.needsUpdate =
true;
2257 warnOnce(
'THREE.Texture: Property .encoding has been replaced by .colorSpace.' );
2264 warnOnce(
'THREE.Texture: Property .encoding has been replaced by .colorSpace.' );
2273 Texture.DEFAULT_ANISOTROPY = 1;
2279 Vector4.prototype.isVector4 =
true;
2370 case 0: this.
x =
value;
break;
2371 case 1: this.y =
value;
break;
2372 case 2: this.z =
value;
break;
2373 case 3: this.
w =
value;
break;
2374 default:
throw new Error(
'index is out of range: ' +
index );
2386 case 0:
return this.
x;
2387 case 1:
return this.
y;
2388 case 2:
return this.
z;
2389 case 3:
return this.
w;
2390 default:
throw new Error(
'index is out of range: ' +
index );
2398 return new this.
constructor( this.
x, this.y, this.z, this.
w );
2514 const x = this.
x, y = this.
y, z = this.
z,
w = this.
w;
2515 const e =
m.elements;
2517 this.
x =
e[ 0 ] *
x +
e[ 4 ] * y +
e[ 8 ] *
z +
e[ 12 ] *
w;
2518 this.y =
e[ 1 ] *
x +
e[ 5 ] *
y +
e[ 9 ] *
z +
e[ 13 ] *
w;
2519 this.z =
e[ 2 ] *
x +
e[ 6 ] *
y +
e[ 10 ] *
z +
e[ 14 ] *
w;
2520 this.w =
e[ 3 ] *
x +
e[ 7 ] *
y +
e[ 11 ] *
z +
e[ 15 ] *
w;
2538 this.
w = 2 *
Math.acos(
q.w );
2540 const s =
Math.sqrt( 1 -
q.w *
q.w );
2591 this.
set( 1, 0, 0, 0 );
2601 const xx = (
m11 + 1 ) / 2;
2602 const yy = (
m22 + 1 ) / 2;
2603 const zz = (
m33 + 1 ) / 2;
2608 if ( (
xx >
yy ) && (
xx >
zz ) ) {
2626 }
else if (
yy >
zz ) {
2676 if (
Math.abs(
s ) < 0.001 )
s = 1;
2684 this.
w =
Math.acos( (
m11 + m22 +
m33 - 1 ) / 2 );
2692 this.x =
Math.min( this.x,
v.x );
2693 this.y =
Math.min( this.y,
v.y );
2694 this.z =
Math.min( this.z,
v.z );
2695 this.
w =
Math.min( this.
w,
v.w );
2703 this.x =
Math.max( this.x,
v.x );
2704 this.y =
Math.max( this.y,
v.y );
2705 this.z =
Math.max( this.z,
v.z );
2706 this.
w =
Math.max( this.
w,
v.w );
2746 this.x =
Math.floor( this.x );
2747 this.y =
Math.floor( this.y );
2748 this.z =
Math.floor( this.z );
2749 this.
w =
Math.floor( this.
w );
2757 this.x =
Math.ceil( this.x );
2758 this.y =
Math.ceil( this.y );
2759 this.z =
Math.ceil( this.z );
2760 this.
w =
Math.ceil( this.
w );
2768 this.x =
Math.round( this.x );
2769 this.y =
Math.round( this.y );
2770 this.z =
Math.round( this.z );
2771 this.
w =
Math.round( this.
w );
2779 this.x =
Math.trunc( this.x );
2780 this.y =
Math.trunc( this.y );
2781 this.z =
Math.trunc( this.z );
2782 this.
w =
Math.trunc( this.
w );
2801 return this.x *
v.x + this.y *
v.y + this.z *
v.z + this.
w *
v.w;
2807 return this.x * this.x + this.y * this.y + this.z * this.z + this.
w * this.
w;
2813 return Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z + this.
w * this.
w );
2819 return Math.abs( this.x ) +
Math.abs( this.y ) +
Math.abs( this.z ) +
Math.abs( this.
w );
2837 this.x += (
v.x - this.
x ) *
alpha;
2838 this.y += (
v.y - this.
y ) *
alpha;
2839 this.z += (
v.z - this.
z ) *
alpha;
2840 this.
w += (
v.w - this.
w ) *
alpha;
2859 return ( (
v.x ===
this.x ) && (
v.y ===
this.y ) && (
v.z ===
this.z ) && (
v.w ===
this.w ) );
2898 this.x =
Math.random();
2899 this.y =
Math.random();
2900 this.z =
Math.random();
2901 this.
w =
Math.random();
2945 warnOnce(
'THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace.' );
2961 this.
texture.isRenderTargetTexture =
true;
3015 this.
texture.isRenderTargetTexture =
true;
3088 this.
texture.isRenderTargetTexture =
true;
3137 this.
texture.isRenderTargetTexture =
true;
3158 this.
texture[
i ].isRenderTargetTexture =
true;
3212 this.
texture[
i ].isRenderTargetTexture =
true;
3273 dir = (
cos >= 0 ? 1 : - 1 ),
3295 if (
s === 1 -
t ) {
3484 console.warn(
'THREE.Quaternion: .setFromEuler() encountered an unknown order: ' +
order );
3519 const te =
m.elements,
3532 this.
_x = ( m32 -
m23 ) *
s;
3533 this.
_y = ( m13 -
m31 ) *
s;
3534 this.
_z = ( m21 -
m12 ) *
s;
3540 this.
_w = ( m32 -
m23 ) /
s;
3542 this.
_y = ( m12 +
m21 ) /
s;
3543 this.
_z = ( m13 +
m31 ) /
s;
3545 }
else if (
m22 >
m33 ) {
3549 this.
_w = ( m13 -
m31 ) /
s;
3550 this.
_x = ( m12 +
m21 ) /
s;
3552 this.
_z = ( m23 +
m32 ) /
s;
3558 this.
_w = ( m21 -
m12 ) /
s;
3559 this.
_x = ( m13 +
m31 ) /
s;
3560 this.
_y = ( m23 +
m32 ) /
s;
3577 if ( r <
Number.EPSILON ) {
3624 if ( angle === 0 )
return this;
3636 return this.
set( 0, 0, 0, 1 );
3662 return this.
_x *
v._x + this.
_y *
v._y + this.
_z *
v._z + this.
_w *
v._w;
3668 return this.
_x * this.
_x + this.
_y * this.
_y + this.
_z * this.
_z + this.
_w * this.
_w;
3674 return Math.sqrt( this.
_x * this.
_x + this.
_y * this.
_y + this.
_z * this.
_z + this.
_w * this.
_w );
3693 this.
_x = this.
_x *
l;
3694 this.
_y = this.
_y *
l;
3695 this.
_z = this.
_z *
l;
3696 this.
_w = this.
_w *
l;
3738 if (
t === 0 )
return this;
3739 if (
t === 1 )
return this.
copy(
qb );
3741 const x = this.
_x, y = this.
_y, z = this.
_z,
w = this.
_w;
3762 if ( cosHalfTheta >= 1.0 ) {
3778 this.
_w = s *
w +
t * this.
_w;
3779 this.
_x = s *
x +
t * this.
_x;
3780 this.
_y = s *
y +
t * this.
_y;
3781 this.
_z = s *
z +
t * this.
_z;
3807 return this.
copy(
qa ).slerp(
qb, t );
3817 const u1 =
Math.random();
3908 Vector3.prototype.isVector3 =
true;
3966 case 0: this.x =
value;
break;
3967 case 1: this.y =
value;
break;
3968 case 2: this.z =
value;
break;
3969 default:
throw new Error(
'index is out of range: ' +
index );
3981 case 0:
return this.
x;
3982 case 1:
return this.
y;
3983 case 2:
return this.
z;
3984 default:
throw new Error(
'index is out of range: ' +
index );
3992 return new this.
constructor( this.x, this.y, this.z );
4120 const x = this.
x, y = this.
y, z = this.
z;
4121 const e =
m.elements;
4123 this.x =
e[ 0 ] *
x +
e[ 3 ] *
y +
e[ 6 ] *
z;
4124 this.y =
e[ 1 ] *
x +
e[ 4 ] *
y +
e[ 7 ] *
z;
4125 this.z =
e[ 2 ] *
x +
e[ 5 ] *
y +
e[ 8 ] *
z;
4139 const x = this.
x, y = this.
y, z = this.
z;
4140 const e =
m.elements;
4142 const w = 1 / (
e[ 3 ] *
x +
e[ 7 ] *
y +
e[ 11 ] *
z +
e[ 15 ] );
4144 this.x = (
e[ 0 ] *
x +
e[ 4 ] *
y +
e[ 8 ] *
z +
e[ 12 ] ) *
w;
4145 this.y = (
e[ 1 ] *
x +
e[ 5 ] *
y +
e[ 9 ] *
z +
e[ 13 ] ) *
w;
4146 this.z = (
e[ 2 ] *
x +
e[ 6 ] *
y +
e[ 10 ] *
z +
e[ 14 ] ) *
w;
4156 const vx = this.
x,
vy = this.
y,
vz = this.
z;
4160 const tx = 2 * (
qy * vz -
qz *
vy );
4190 const x = this.
x, y = this.
y, z = this.
z;
4191 const e =
m.elements;
4193 this.x =
e[ 0 ] *
x +
e[ 4 ] *
y +
e[ 8 ] *
z;
4194 this.y =
e[ 1 ] *
x +
e[ 5 ] *
y +
e[ 9 ] *
z;
4195 this.z =
e[ 2 ] *
x +
e[ 6 ] *
y +
e[ 10 ] *
z;
4219 this.x =
Math.min( this.x,
v.x );
4220 this.y =
Math.min( this.y,
v.y );
4221 this.z =
Math.min( this.z,
v.z );
4229 this.x =
Math.max( this.x,
v.x );
4230 this.y =
Math.max( this.y,
v.y );
4231 this.z =
Math.max( this.z,
v.z );
4269 this.x =
Math.floor( this.x );
4270 this.y =
Math.floor( this.y );
4271 this.z =
Math.floor( this.z );
4279 this.x =
Math.ceil( this.x );
4280 this.y =
Math.ceil( this.y );
4281 this.z =
Math.ceil( this.z );
4289 this.x =
Math.round( this.x );
4290 this.y =
Math.round( this.y );
4291 this.z =
Math.round( this.z );
4299 this.x =
Math.trunc( this.x );
4300 this.y =
Math.trunc( this.y );
4301 this.z =
Math.trunc( this.z );
4319 return this.x *
v.x + this.y *
v.y + this.z *
v.z;
4327 return this.x * this.x + this.y * this.y + this.z * this.
z;
4333 return Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z );
4339 return Math.abs( this.x ) +
Math.abs( this.y ) +
Math.abs( this.z );
4357 this.x += (
v.x - this.
x ) *
alpha;
4358 this.y += (
v.y - this.
y ) *
alpha;
4359 this.z += (
v.z - this.
z ) *
alpha;
4398 if (
denominator === 0 )
return this.
set( 0, 0, 0 );
4445 const dx = this.x -
v.x,
dy = this.y -
v.y,
dz = this.z -
v.z;
4453 return Math.abs( this.x -
v.x ) +
Math.abs( this.y -
v.y ) +
Math.abs( this.z -
v.z );
4493 const e =
m.elements;
4551 return ( (
v.x ===
this.x ) && (
v.y ===
this.y ) && (
v.z ===
this.z ) );
4587 this.x =
Math.random();
4588 this.y =
Math.random();
4589 this.z =
Math.random();
4599 const u = (
Math.random() - 0.5 ) * 2;
4601 const f =
Math.sqrt( 1 -
u ** 2 );
4603 this.x =
f *
Math.cos(
t );
4604 this.y =
f *
Math.sin(
t );
4713 this.
min.copy(
box.min );
4714 this.
max.copy(
box.max );
4733 return ( this.
max.x <
this.min.x ) || ( this.
max.y < this.
min.y ) || ( this.
max.z <
this.min.z );
4781 object.updateWorldMatrix(
false,
false );
4796 if (
object.
isMesh ===
true ) {
4819 object.computeBoundingBox();
4830 if (
geometry.boundingBox ===
null ) {
4870 return this.
min.x <=
box.min.x &&
box.max.x <= this.
max.x &&
4882 (
point.x -
this.min.x ) / (
this.max.x -
this.min.x ),
4883 (
point.y -
this.min.y ) / (
this.max.y -
this.min.y ),
4884 (
point.z -
this.min.z ) / (
this.max.z -
this.min.z )
4892 return box.max.x < this.
min.x ||
box.min.x > this.
max.x ||
4915 if (
plane.normal.x > 0 ) {
4917 min =
plane.normal.x * this.min.x;
4927 if (
plane.normal.y > 0 ) {
4929 min +=
plane.normal.y * this.min.y;
4930 max +=
plane.normal.y * this.max.y;
4934 min +=
plane.normal.y * this.max.y;
4935 max +=
plane.normal.y * this.min.y;
4939 if (
plane.normal.z > 0 ) {
4941 min +=
plane.normal.z * this.min.z;
4942 max +=
plane.normal.z * this.max.z;
4946 min +=
plane.normal.z * this.max.z;
4947 max +=
plane.normal.z * this.min.z;
4992 axes = [ 1, 0, 0, 0, 1, 0, 0, 0, 1 ];
5010 return target.copy(
point ).clamp( this.min, this.max );
5040 this.min.max(
box.min );
5041 this.max.min(
box.max );
5052 this.min.min(
box.min );
5053 this.max.max(
box.max );
5062 if ( this.
isEmpty() )
return this;
5065 _points[ 0 ].set( this.min.x,
this.min.y,
this.min.z ).applyMatrix4(
matrix );
5066 _points[ 1 ].set( this.min.x,
this.min.y,
this.max.z ).applyMatrix4(
matrix );
5067 _points[ 2 ].set( this.min.x,
this.max.y,
this.min.z ).applyMatrix4(
matrix );
5068 _points[ 3 ].set( this.min.x,
this.max.y,
this.max.z ).applyMatrix4(
matrix );
5069 _points[ 4 ].set( this.max.x,
this.min.y,
this.min.z ).applyMatrix4(
matrix );
5070 _points[ 5 ].set( this.max.x,
this.min.y,
this.max.z ).applyMatrix4(
matrix );
5071 _points[ 6 ].set( this.max.x,
this.max.y,
this.min.z ).applyMatrix4(
matrix );
5072 _points[ 7 ].set( this.max.x,
this.max.y,
this.max.z ).applyMatrix4(
matrix );
5091 return box.min.equals( this.min ) &&
box.max.equals( this.max );
5131 for (
let i = 0,
j =
axes.length - 3;
i <=
j;
i += 3 ) {
5218 return ( this.
radius < 0 );
5224 this.
center.set( 0, 0, 0 );
5233 return (
point.distanceToSquared(
this.center ) <= (
this.radius *
this.radius ) );
5239 return (
point.distanceTo(
this.center ) -
this.radius );
5253 return box.intersectsSphere(
this );
5259 return Math.abs(
plane.distanceToPoint(
this.center ) ) <= this.
radius;
5272 target.multiplyScalar( this.radius ).add( this.
center );
5291 target.expandByScalar( this.radius );
5300 this.radius = this.radius *
matrix.getMaxScaleOnAxis();
5330 if (
lengthSq > ( this.radius * this.radius ) ) {
5340 this.radius +=
delta;
5350 if (
sphere.isEmpty() ) {
5366 this.radius =
Math.max( this.radius,
sphere.radius );
5511 const c =
_diff.lengthSq();
5625 const t0 = tca -
thc;
5631 if (
t1 < 0 )
return null;
5656 if (
plane.distanceToPoint(
this.origin ) === 0 ) {
5672 return t >= 0 ?
t :
null;
5776 if (
tmax < 0 )
return null;
5811 }
else if (
DdN < 0 ) {
5888 constructor( n11,
n12,
n13,
n14,
n21,
n22,
n23,
n24,
n31,
n32,
n33,
n34,
n41,
n42,
n43,
n44 ) {
5890 Matrix4.prototype.isMatrix4 =
true;
5903 this.
set(
n11,
n12,
n13,
n14,
n21,
n22,
n23,
n24,
n31,
n32,
n33,
n34,
n41,
n42,
n43,
n44 );
5909 set(
n11,
n12,
n13,
n14,
n21,
n22,
n23,
n24,
n31,
n32,
n33,
n34,
n41,
n42,
n43,
n44 ) {
5946 const me =
m.elements;
5948 te[ 0 ] =
me[ 0 ];
te[ 1 ] =
me[ 1 ];
te[ 2 ] =
me[ 2 ];
te[ 3 ] =
me[ 3 ];
5949 te[ 4 ] =
me[ 4 ];
te[ 5 ] =
me[ 5 ];
te[ 6 ] =
me[ 6 ];
te[ 7 ] =
me[ 7 ];
5950 te[ 8 ] =
me[ 8 ];
te[ 9 ] =
me[ 9 ];
te[ 10 ] =
me[ 10 ];
te[ 11 ] =
me[ 11 ];
5951 te[ 12 ] =
me[ 12 ];
te[ 13 ] =
me[ 13 ];
te[ 14 ] =
me[ 14 ];
te[ 15 ] =
me[ 15 ];
5961 te[ 12 ] = me[ 12 ];
5962 te[ 13 ] =
me[ 13 ];
5963 te[ 14 ] =
me[ 14 ];
5971 const me =
m.elements;
5975 me[ 0 ],
me[ 3 ], me[ 6 ], 0,
5976 me[ 1 ],
me[ 4 ],
me[ 7 ], 0,
5977 me[ 2 ],
me[ 5 ],
me[ 8 ], 0,
5988 xAxis.setFromMatrixColumn(
this, 0 );
5989 yAxis.setFromMatrixColumn(
this, 1 );
5990 zAxis.setFromMatrixColumn(
this, 2 );
6014 const me =
m.elements;
6016 const scaleX = 1 /
_v1$5.setFromMatrixColumn(
m, 0 ).length();
6017 const scaleY = 1 /
_v1$5.setFromMatrixColumn(
m, 1 ).length();
6018 const scaleZ = 1 /
_v1$5.setFromMatrixColumn(
m, 2 ).length();
6053 if (
euler.order ===
'XYZ' ) {
6069 }
else if (
euler.order ===
'YXZ' ) {
6085 }
else if (
euler.order ===
'ZXY' ) {
6101 }
else if (
euler.order ===
'ZYX' ) {
6117 }
else if (
euler.order ===
'YZX' ) {
6133 }
else if (
euler.order ===
'XZY' ) {
6178 if (
_z.lengthSq() === 0 ) {
6187 _x.crossVectors(
up,
_z );
6189 if (
_x.lengthSq() === 0 ) {
6193 if (
Math.abs(
up.z ) === 1 ) {
6204 _x.crossVectors(
up,
_z );
6209 _y.crossVectors(
_z,
_x );
6233 const ae =
a.elements;
6234 const be =
b.elements;
6275 te[ 0 ] *=
s;
te[ 4 ] *=
s;
te[ 8 ] *=
s;
te[ 12 ] *=
s;
6276 te[ 1 ] *=
s;
te[ 5 ] *=
s;
te[ 9 ] *=
s;
te[ 13 ] *=
s;
6277 te[ 2 ] *=
s;
te[ 6 ] *=
s;
te[ 10 ] *=
s;
te[ 14 ] *=
s;
6278 te[ 3 ] *=
s;
te[ 7 ] *=
s;
te[ 11 ] *=
s;
te[ 15 ] *=
s;
6355 if ( x.isVector3 ) {
6390 if (
det === 0 )
return this.
set( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 );
6421 const x =
v.x,
y =
v.y,
z =
v.z;
6423 te[ 0 ] *=
x;
te[ 4 ] *=
y;
te[ 8 ] *=
z;
6424 te[ 1 ] *=
x;
te[ 5 ] *=
y;
te[ 9 ] *=
z;
6425 te[ 2 ] *=
x;
te[ 6 ] *=
y;
te[ 10 ] *=
z;
6426 te[ 3 ] *=
x;
te[ 7 ] *=
y;
te[ 11 ] *=
z;
6446 if (
x.isVector3 ) {
6590 te[ 0 ] = ( 1 - (
yy +
zz ) ) *
sx;
6596 te[ 5 ] = ( 1 - (
xx +
zz ) ) *
sy;
6602 te[ 10 ] = ( 1 - (
xx +
yy ) ) *
sz;
6620 const sz =
_v1$5.set(
te[ 8 ],
te[ 9 ],
te[ 10 ] ).length();
6624 if ( det < 0 )
sx = -
sx;
6682 throw new Error(
'THREE.Matrix4.makePerspective(): Invalid coordinate system: ' +
coordinateSystem );
6686 te[ 0 ] =
x;
te[ 4 ] = 0;
te[ 8 ] =
a;
te[ 12 ] = 0;
6687 te[ 1 ] = 0;
te[ 5 ] =
y;
te[ 9 ] =
b;
te[ 13 ] = 0;
6688 te[ 2 ] = 0;
te[ 6 ] = 0;
te[ 10 ] =
c;
te[ 14 ] =
d;
6689 te[ 3 ] = 0;
te[ 7 ] = 0;
te[ 11 ] = - 1;
te[ 15 ] = 0;
6719 throw new Error(
'THREE.Matrix4.makeOrthographic(): Invalid coordinate system: ' +
coordinateSystem );
6723 te[ 0 ] = 2 *
w;
te[ 4 ] = 0;
te[ 8 ] = 0;
te[ 12 ] = -
x;
6724 te[ 1 ] = 0;
te[ 5 ] = 2 *
h;
te[ 9 ] = 0;
te[ 13 ] = -
y;
6726 te[ 3 ] = 0;
te[ 7 ] = 0;
te[ 11 ] = 0;
te[ 15 ] = 1;
6737 for (
let i = 0;
i < 16;
i ++ ) {
6739 if ( te[
i ] !==
me[
i ] )
return false;
6749 for (
let i = 0;
i < 16;
i ++ ) {
6901 const te =
m.elements;
6912 if (
Math.abs(
m13 ) < 0.9999999 ) {
6930 if (
Math.abs(
m23 ) < 0.9999999 ) {
6948 if (
Math.abs(
m32 ) < 0.9999999 ) {
6966 if (
Math.abs(
m31 ) < 0.9999999 ) {
6984 if (
Math.abs(
m21 ) < 0.9999999 ) {
7002 if (
Math.abs(
m12 ) < 0.9999999 ) {
7018 console.warn(
'THREE.Euler: .setFromRotationMatrix() encountered an unknown order: ' + order );
7040 return this.
set(
v.x,
v.y,
v.z,
order );
7105 Euler.DEFAULT_ORDER =
'XYZ';
7129 this.
mask = 0xffffffff | 0;
7159 return ( this.
mask & ( 1 <<
channel | 0 ) ) !== 0;
7191 Object.defineProperty(
this,
'id', {
value: _object3DId ++ } );
7196 this.type =
'Object3D';
7223 Object.defineProperties(
this, {
7419 return vector.applyMatrix4(
_m1$1.copy(
this.matrixWorld ).invert() );
7427 if (
x.isVector3 ) {
7458 _q1.setFromRotationMatrix(
_m1$1 );
7479 if (
object ===
this ) {
7481 console.error(
'THREE.Object3D.add: object can\'t be added as a child of itself.',
object );
7488 if (
object.
parent !==
null ) {
7490 object.parent.remove(
object );
7494 object.parent =
this;
7501 console.error(
'THREE.Object3D.add: object not an instance of THREE.Object3D.',
object );
7525 if (
index !== - 1 ) {
7527 object.parent =
null;
7554 return this.
remove( ... this.
children );
7568 if (
object.
parent !==
null ) {
7570 object.parent.updateWorldMatrix(
true,
false );
7576 object.applyMatrix4(
_m1$1 );
7580 object.updateWorldMatrix(
false,
true );
7600 if (
this[
name ] ===
value )
return this;
7669 return target.set(
e[ 8 ],
e[ 9 ],
e[ 10 ] ).normalize();
7691 if ( this.
visible ===
false )
return;
7733 if ( this.
parent ===
null ) {
7757 if (
child.matrixWorldAutoUpdate ===
true ||
force ===
true ) {
7773 parent.updateWorldMatrix(
true,
false );
7779 if ( this.
parent ===
null ) {
7799 if (
child.matrixWorldAutoUpdate ===
true ) {
7801 child.updateWorldMatrix(
false,
true );
7847 object.uuid = this.
uuid;
7848 object.type = this.type;
7850 if ( this.
name !==
'' )
object.name = this.
name;
7851 if ( this.
castShadow ===
true )
object.castShadow =
true;
7852 if ( this.
receiveShadow ===
true )
object.receiveShadow =
true;
7853 if ( this.
visible ===
false )
object.visible =
false;
7854 if ( this.
frustumCulled ===
false )
object.frustumCulled =
false;
7858 object.layers = this.
layers.mask;
7859 object.matrix = this.
matrix.toArray();
7860 object.up = this.
up.toArray();
7868 object.type =
'InstancedMesh';
7869 object.count = this.
count;
7877 object.type =
'BatchedMesh';
7907 object.boundingSphere = {
7908 center:
object.boundingSphere.center.toArray(),
7909 radius:
object.boundingSphere.radius
7916 object.boundingBox = {
7917 min:
object.boundingBox.min.toArray(),
7918 max:
object.boundingBox.max.toArray()
7945 object.background = this.
background.toJSON();
7949 object.background = this.
background.toJSON( meta ).uuid;
7955 if ( this.
environment && this.
environment.isTexture &&
this.environment.isRenderTargetTexture !==
true ) {
7957 object.environment = this.
environment.toJSON( meta ).uuid;
7963 object.geometry =
serialize( meta.geometries,
this.geometry );
7994 object.bindMatrix = this.
bindMatrix.toArray();
7998 serialize( meta.skeletons,
this.skeleton );
8000 object.skeleton = this.
skeleton.uuid;
8008 if (
Array.isArray(
this.material ) ) {
8018 object.material =
uuids;
8022 object.material =
serialize(
meta.materials,
this.material );
8032 object.children = [];
8046 object.animations = [];
8070 if ( materials.length > 0 )
output.materials = materials;
8093 delete data.metadata;
8160 Object3D.DEFAULT_MATRIX_AUTO_UPDATE =
true;
8161 Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE =
true;
8200 return target.set( 0, 0, 0 );
8221 if (
denom === 0 ) {
8254 console.warn(
'THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation().' );
8343 _v0$1.subVectors( this.c, this.b );
8344 _v1$3.subVectors( this.
a, this.b );
8352 return target.addVectors( this.
a, this.b ).add( this.c ).multiplyScalar( 1 / 3 );
8364 return target.setFromCoplanarPoints( this.
a, this.b, this.c );
8378 console.warn(
'THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation().' );
8408 return box.intersectsTriangle(
this );
8414 const a = this.
a, b = this.
b, c = this.
c;
8423 _vab.subVectors( b,
a );
8428 if (
d1 <= 0 &&
d2 <= 0 ) {
8438 if (
d3 >= 0 &&
d4 <=
d3 ) {
8457 if (
d6 >= 0 &&
d5 <=
d6 ) {
8474 if (
va <= 0 && (
d4 -
d3 ) >= 0 && (
d5 -
d6 ) >= 0 ) {
8501 const _colorKeywords = {
'aliceblue': 0xF0F8FF,
'antiquewhite': 0xFAEBD7,
'aqua': 0x00FFFF,
'aquamarine': 0x7FFFD4,
'azure': 0xF0FFFF,
8502 'beige': 0xF5F5DC,
'bisque': 0xFFE4C4,
'black': 0x000000,
'blanchedalmond': 0xFFEBCD,
'blue': 0x0000FF,
'blueviolet': 0x8A2BE2,
8503 'brown': 0xA52A2A,
'burlywood': 0xDEB887,
'cadetblue': 0x5F9EA0,
'chartreuse': 0x7FFF00,
'chocolate': 0xD2691E,
'coral': 0xFF7F50,
8504 'cornflowerblue': 0x6495ED,
'cornsilk': 0xFFF8DC,
'crimson': 0xDC143C,
'cyan': 0x00FFFF,
'darkblue': 0x00008B,
'darkcyan': 0x008B8B,
8505 'darkgoldenrod': 0xB8860B,
'darkgray': 0xA9A9A9,
'darkgreen': 0x006400,
'darkgrey': 0xA9A9A9,
'darkkhaki': 0xBDB76B,
'darkmagenta': 0x8B008B,
8506 'darkolivegreen': 0x556B2F,
'darkorange': 0xFF8C00,
'darkorchid': 0x9932CC,
'darkred': 0x8B0000,
'darksalmon': 0xE9967A,
'darkseagreen': 0x8FBC8F,
8507 'darkslateblue': 0x483D8B,
'darkslategray': 0x2F4F4F,
'darkslategrey': 0x2F4F4F,
'darkturquoise': 0x00CED1,
'darkviolet': 0x9400D3,
8508 'deeppink': 0xFF1493,
'deepskyblue': 0x00BFFF,
'dimgray': 0x696969,
'dimgrey': 0x696969,
'dodgerblue': 0x1E90FF,
'firebrick': 0xB22222,
8509 'floralwhite': 0xFFFAF0,
'forestgreen': 0x228B22,
'fuchsia': 0xFF00FF,
'gainsboro': 0xDCDCDC,
'ghostwhite': 0xF8F8FF,
'gold': 0xFFD700,
8510 'goldenrod': 0xDAA520,
'gray': 0x808080,
'green': 0x008000,
'greenyellow': 0xADFF2F,
'grey': 0x808080,
'honeydew': 0xF0FFF0,
'hotpink': 0xFF69B4,
8511 'indianred': 0xCD5C5C,
'indigo': 0x4B0082,
'ivory': 0xFFFFF0,
'khaki': 0xF0E68C,
'lavender': 0xE6E6FA,
'lavenderblush': 0xFFF0F5,
'lawngreen': 0x7CFC00,
8512 'lemonchiffon': 0xFFFACD,
'lightblue': 0xADD8E6,
'lightcoral': 0xF08080,
'lightcyan': 0xE0FFFF,
'lightgoldenrodyellow': 0xFAFAD2,
'lightgray': 0xD3D3D3,
8513 'lightgreen': 0x90EE90,
'lightgrey': 0xD3D3D3,
'lightpink': 0xFFB6C1,
'lightsalmon': 0xFFA07A,
'lightseagreen': 0x20B2AA,
'lightskyblue': 0x87CEFA,
8514 'lightslategray': 0x778899,
'lightslategrey': 0x778899,
'lightsteelblue': 0xB0C4DE,
'lightyellow': 0xFFFFE0,
'lime': 0x00FF00,
'limegreen': 0x32CD32,
8515 'linen': 0xFAF0E6,
'magenta': 0xFF00FF,
'maroon': 0x800000,
'mediumaquamarine': 0x66CDAA,
'mediumblue': 0x0000CD,
'mediumorchid': 0xBA55D3,
8516 'mediumpurple': 0x9370DB,
'mediumseagreen': 0x3CB371,
'mediumslateblue': 0x7B68EE,
'mediumspringgreen': 0x00FA9A,
'mediumturquoise': 0x48D1CC,
8517 'mediumvioletred': 0xC71585,
'midnightblue': 0x191970,
'mintcream': 0xF5FFFA,
'mistyrose': 0xFFE4E1,
'moccasin': 0xFFE4B5,
'navajowhite': 0xFFDEAD,
8518 'navy': 0x000080,
'oldlace': 0xFDF5E6,
'olive': 0x808000,
'olivedrab': 0x6B8E23,
'orange': 0xFFA500,
'orangered': 0xFF4500,
'orchid': 0xDA70D6,
8519 'palegoldenrod': 0xEEE8AA,
'palegreen': 0x98FB98,
'paleturquoise': 0xAFEEEE,
'palevioletred': 0xDB7093,
'papayawhip': 0xFFEFD5,
'peachpuff': 0xFFDAB9,
8520 'peru': 0xCD853F,
'pink': 0xFFC0CB,
'plum': 0xDDA0DD,
'powderblue': 0xB0E0E6,
'purple': 0x800080,
'rebeccapurple': 0x663399,
'red': 0xFF0000,
'rosybrown': 0xBC8F8F,
8521 'royalblue': 0x4169E1,
'saddlebrown': 0x8B4513,
'salmon': 0xFA8072,
'sandybrown': 0xF4A460,
'seagreen': 0x2E8B57,
'seashell': 0xFFF5EE,
8522 'sienna': 0xA0522D,
'silver': 0xC0C0C0,
'skyblue': 0x87CEEB,
'slateblue': 0x6A5ACD,
'slategray': 0x708090,
'slategrey': 0x708090,
'snow': 0xFFFAFA,
8523 'springgreen': 0x00FF7F,
'steelblue': 0x4682B4,
'tan': 0xD2B48C,
'teal': 0x008080,
'thistle': 0xD8BFD8,
'tomato': 0xFF6347,
'turquoise': 0x40E0D0,
8524 'violet': 0xEE82EE,
'wheat': 0xF5DEB3,
'white': 0xFFFFFF,
'whitesmoke': 0xF5F5F5,
'yellow': 0xFFFF00,
'yellowgreen': 0x9ACD32 };
8526 const _hslA = {
h: 0,
s: 0,
l: 0 };
8527 const _hslB = {
h: 0,
s: 0,
l: 0 };
8531 if (
t < 0 )
t += 1;
8532 if (
t > 1 )
t -= 1;
8533 if (
t < 1 / 6 )
return p + (
q -
p ) * 6 *
t;
8534 if (
t < 1 / 2 )
return q;
8535 if (
t < 2 / 3 )
return p + (
q -
p ) * 6 * ( 2 / 3 -
t );
8550 return this.
set(
r,
g,
b );
8598 hex =
Math.floor( hex );
8600 this.r = ( hex >> 16 & 255 ) / 255;
8601 this.g = ( hex >> 8 & 255 ) / 255;
8602 this.b = ( hex & 255 ) / 255;
8631 this.r = this.g = this.b =
l;
8635 const p =
l <= 0.5 ?
l * ( 1 +
s ) :
l +
s - (
l *
s );
8636 const q = ( 2 *
l ) -
p;
8658 console.warn(
'THREE.Color: Alpha component of ' +
style +
' will be ignored.' );
8667 if (
m = /^(\
w+)\(([^\)]*)\)/.exec(
style ) ) {
8672 const name =
m[ 1 ];
8734 console.warn(
'THREE.Color: Unknown color model ' +
style );
8743 const size = hex.length;
8749 parseInt( hex.charAt( 0 ), 16 ) / 15,
8750 parseInt( hex.charAt( 1 ), 16 ) / 15,
8751 parseInt( hex.charAt( 2 ), 16 ) / 15,
8755 }
else if (
size === 6 ) {
8762 console.warn(
'THREE.Color: Invalid hex color ' +
style );
8799 return new this.
constructor( this.r, this.g, this.b );
8859 return (
'000000' + this.
getHex(
colorSpace ).toString( 16 ) ).slice( - 6 );
8977 this.r =
Math.max( 0, this.r -
color.r );
8978 this.g =
Math.max( 0, this.g -
color.g );
8979 this.b =
Math.max( 0, this.b -
color.b );
9028 color.getHSL(
_hslB );
9052 const r = this.
r, g = this.
g, b = this.
b;
9053 const e = m.elements;
9055 this.r =
e[ 0 ] *
r +
e[ 3 ] *
g +
e[ 6 ] *
b;
9056 this.g =
e[ 1 ] *
r +
e[ 4 ] *
g +
e[ 7 ] *
b;
9057 this.b =
e[ 2 ] *
r +
e[ 5 ] *
g +
e[ 8 ] *
b;
9065 return (
c.r ===
this.r ) && (
c.g === this.
g ) && ( c.b ===
this.b );
9129 Object.defineProperty(
this,
'id', {
value: _materialId ++ } );
9134 this.type =
'Material';
9293 data.type = this.type;
9297 if ( this.color && this.color.isColor )
data.color = this.color.getHex();
9359 if ( this.
map && this.
map.isTexture )
data.map = this.
map.toJSON( meta ).uuid;
9372 data.aoMap = this.
aoMap.toJSON( meta ).uuid;
9410 data.envMap = this.
envMap.toJSON( meta ).uuid;
9494 if ( this.
visible ===
false )
data.visible =
false;
9498 if ( this.
fog ===
false )
data.fog =
false;
9500 if (
Object.keys(
this.userData ).length > 0 )
data.userData =
this.userData;
9511 delete data.metadata;
9579 dstPlanes =
new Array(
n );
9581 for (
let i = 0;
i !==
n; ++
i ) {
9643 this.type =
'MeshBasicMaterial';
9679 this.color.copy(
source.color );
9726 for (
let i = 0;
i < 256; ++
i ) {
9741 }
else if (
e < - 14 ) {
9744 baseTable[
i | 0x100 ] = ( 0x0400 >> ( -
e - 14 ) ) | 0x8000;
9750 }
else if (
e <= 15 ) {
9753 baseTable[
i | 0x100 ] = ( (
e + 15 ) << 10 ) | 0x8000;
9759 }
else if (
e < 128 ) {
9785 for (
let i = 1;
i < 1024; ++
i ) {
9805 for (
let i = 1024;
i < 2048; ++
i ) {
9811 for (
let i = 1;
i < 31; ++
i ) {
9820 for (
let i = 33;
i < 63; ++
i ) {
9828 for (
let i = 1;
i < 64; ++
i ) {
9854 if (
Math.abs(
val ) > 65504 )
console.warn(
'THREE.DataUtils.toHalfFloat(): Value out of range.' );
9860 const e = (
f >> 23 ) & 0
x1ff;
9861 return _tables.baseTable[
e ] + ( (
f & 0x007fffff ) >>
_tables.shiftTable[
e ] );
9869 const m =
val >> 10;
9871 return _tables.floatView[ 0 ];
9889 throw new TypeError(
'THREE.BufferAttribute: array should be a Typed Array.' );
9921 console.warn(
'THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead.' );
9951 this.count =
source.count;
9988 for (
let i = 0, l = this.count;
i <
l;
i ++ ) {
9997 }
else if ( this.
itemSize === 3 ) {
9999 for (
let i = 0, l = this.count;
i <
l;
i ++ ) {
10016 for (
let i = 0,
l = this.count;
i <
l;
i ++ ) {
10032 for (
let i = 0,
l = this.count;
i <
l;
i ++ ) {
10048 for (
let i = 0,
l = this.count;
i <
l;
i ++ ) {
10249 type: this.
array.constructor.name,
10525 Object.defineProperty(
this,
'id', {
value: _id$2 ++ } );
10530 this.type =
'BufferGeometry';
10644 normal.needsUpdate =
true;
10676 _m1.makeRotationFromQuaternion(
q );
10724 _m1.makeTranslation(
x,
y,
z );
10736 _m1.makeScale(
x,
y,
z );
10748 _obj.updateMatrix();
10798 console.error(
'THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',
this );
10849 console.error(
'THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',
this );
10868 console.error(
'THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',
this );
10917 let maxRadiusSq = 0;
10959 console.error(
'THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',
this );
10975 if (
index ===
null ||
10980 console.error(
'THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)' );
11042 sdir.copy(
vB ).multiplyScalar(
uvC.y ).addScaledVector(
vC, -
uvB.y ).multiplyScalar(
r );
11043 tdir.copy(
vC ).multiplyScalar(
uvB.x ).addScaledVector(
vB, -
uvC.x ).multiplyScalar(
r );
11057 if ( groups.length === 0 ) {
11070 const start =
group.start;
11098 tmp.sub(
n.multiplyScalar(
n.dot(
t ) ) ).normalize();
11104 const w = (
test < 0.0 ) ? - 1.0 : 1.0;
11117 const start =
group.start;
11176 cb.subVectors(
pC,
pB );
11177 ab.subVectors(
pA,
pB );
11204 cb.subVectors(
pC,
pB );
11205 ab.subVectors(
pA,
pB );
11218 normalAttribute.needsUpdate =
true;
11254 if (
attribute.isInterleavedBufferAttribute ) {
11278 if ( this.index ===
null ) {
11280 console.warn(
'THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed.' );
11287 const indices = this.index.array;
11329 const groups = this.
groups;
11347 type:
'BufferGeometry',
11355 data.type = this.type;
11379 if ( index !==
null ) {
11381 data.data.index = {
11382 type:
index.array.constructor.name,
11390 for (
const key in attributes ) {
11401 for (
const key in this.morphAttributes ) {
11415 if (
array.length > 0 ) {
11432 const groups = this.
groups;
11434 if ( groups.length > 0 ) {
11444 data.data.boundingSphere = {
11466 this.attributes = {};
11467 this.morphAttributes = {};
11482 const index =
source.index;
11484 if (
index !==
null ) {
11503 const morphAttributes =
source.morphAttributes;
11524 const groups =
source.groups;
11605 this.type =
'Mesh';
11641 const morphAttributes =
geometry.morphAttributes;
11644 if (
keys.length > 0 ) {
11746 if (
geometry.boundingBox !==
null ) {
11748 if (
_ray$3.intersectsBox(
geometry.boundingBox ) ===
false )
return;
11773 if (
index !==
null ) {
11790 const b =
index.getX(
j + 1 );
11791 const c =
index.getX(
j + 2 );
11815 const b =
index.getX(
i + 1 );
11816 const c =
index.getX(
i + 2 );
11928 object.getVertexPosition(
a,
_vA$1 );
11929 object.getVertexPosition(
b,
_vB$1 );
11930 object.getVertexPosition(
c,
_vC$1 );
11997 this.type =
'BoxGeometry';
11999 this.parameters = {
12008 const scope =
this;
12030 buildPlane(
'z',
'y',
'x', - 1, - 1,
depth,
height,
width,
depthSegments,
heightSegments, 0 );
12031 buildPlane(
'z',
'y',
'x', 1, - 1,
depth,
height, -
width,
depthSegments,
heightSegments, 1 );
12032 buildPlane(
'x',
'z',
'y', 1, 1,
width,
depth,
height,
widthSegments,
depthSegments, 2 );
12033 buildPlane(
'x',
'z',
'y', 1, - 1,
width,
depth, -
height,
widthSegments,
depthSegments, 3 );
12034 buildPlane(
'x',
'y',
'z', 1, - 1,
width,
height,
depth,
widthSegments,
heightSegments, 4 );
12035 buildPlane(
'x',
'y',
'z', - 1, - 1,
width,
height, -
depth,
widthSegments,
heightSegments, 5 );
12044 function buildPlane(
u, v,
w,
udir,
vdir,
width,
height,
depth,
gridX,
gridY,
materialIndex ) {
12152 this.parameters =
Object.assign( {},
source.parameters );
12174 for (
const u in src ) {
12178 for (
const p in src[
u ] ) {
12180 const property =
src[
u ][
p ];
12187 if (
property.isRenderTargetTexture ) {
12189 console.warn(
'UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms().' );
12190 dst[
u ][
p ] =
null;
12194 dst[
u ][
p ] =
property.clone();
12200 dst[
u ][
p ] =
property.slice();
12224 for (
const p in tmp ) {
12240 for (
let u = 0;
u <
src.length;
u ++ ) {
12252 if ( renderer.getRenderTarget() ===
null ) {
12255 return renderer.outputColorSpace;
12267 var default_vertex =
"void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}";
12279 this.type =
'ShaderMaterial';
12310 'color': [ 1, 1, 1 ],
12360 data.uniforms = {};
12460 this.type =
'Camera';
12488 return super.getWorldDirection(
target ).negate();
12524 this.type =
'PerspectiveCamera';
12548 this.zoom =
source.zoom;
12596 Math.tan(
DEG2RAD * 0.5 *
this.fov ) /
this.zoom );
12653 if ( this.
view ===
null ) {
12667 this.
view.enabled =
true;
12670 this.
view.offsetX =
x;
12671 this.
view.offsetY =
y;
12681 if ( this.
view !==
null ) {
12683 this.
view.enabled =
false;
12700 if ( this.
view !==
null && this.
view.enabled ) {
12725 data.object.fov = this.fov;
12726 data.object.zoom = this.zoom;
12754 this.type =
'CubeCamera';
12801 cameraNX.up.set( 0, 1, 0 );
12838 throw new Error(
'THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: ' +
coordinateSystem );
12846 camera.updateMatrixWorld();
12874 renderer.xr.enabled =
false;
12924 this.
flipY =
false;
12956 warnOnce(
'THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace.' );
12971 this.
texture.isRenderTargetTexture =
true;
13007 #include <begin_vertex>
13008 #include <project_vertex>
13037 name:
'CubemapFromEquirect',
13061 mesh.geometry.dispose();
13062 mesh.material.dispose();
13072 for (
let i = 0;
i < 6;
i ++ ) {
13074 renderer.setRenderTarget(
this,
i );
13201 return target.copy(
line.start );
13218 return target.copy(
line.start ).addScaledVector(
direction,
t );
13235 return box.intersectsPlane(
this );
13241 return sphere.intersectsPlane(
this );
13317 for (
let i = 0;
i < 6;
i ++ ) {
13330 const me = m.elements;
13352 throw new Error(
'THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: ' +
coordinateSystem );
13364 if (
object.
boundingSphere ===
null )
object.computeBoundingSphere();
13398 for (
let i = 0;
i < 6;
i ++ ) {
13418 for (
let i = 0;
i < 6;
i ++ ) {
13444 for (
let i = 0;
i < 6;
i ++ ) {
13468 let context =
null;
13483 start:
function () {
13494 stop:
function () {
13496 context.cancelAnimationFrame(
requestId );
13545 if (
attribute.isFloat16BufferAttribute ) {
13549 type =
gl.HALF_FLOAT;
13553 throw new Error(
'THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.' );
13559 type =
gl.UNSIGNED_SHORT;
13569 type =
gl.UNSIGNED_INT;
13581 type =
gl.UNSIGNED_BYTE;
13585 type =
gl.UNSIGNED_BYTE;
13589 throw new Error(
'THREE.WebGLAttributes: Unsupported buffer data format: ' +
array );
13682 gl.deleteBuffer(
data.buffer );
13723 throw new Error(
'THREE.WebGLAttributes: The size of the buffer attribute\'s array buffer does not match the original size. Resizing buffer attributes is not supported.' );
13751 this.type =
'PlaneGeometry';
13753 this.parameters = {
13825 this.parameters =
Object.assign( {},
source.parameters );
13839 var alphahash_fragment =
"#ifdef USE_ALPHAHASH\n\tif ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif";
13841 var alphahash_pars_fragment =
"#ifdef USE_ALPHAHASH\n\tconst float ALPHA_HASH_SCALE = 0.05;\n\tfloat hash2D( vec2 value ) {\n\t\treturn fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n\t}\n\tfloat hash3D( vec3 value ) {\n\t\treturn hash2D( vec2( hash2D( value.xy ), value.z ) );\n\t}\n\tfloat getAlphaHashThreshold( vec3 position ) {\n\t\tfloat maxDeriv = max(\n\t\t\tlength( dFdx( position.xyz ) ),\n\t\t\tlength( dFdy( position.xyz ) )\n\t\t);\n\t\tfloat pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n\t\tvec2 pixScales = vec2(\n\t\t\texp2( floor( log2( pixScale ) ) ),\n\t\t\texp2( ceil( log2( pixScale ) ) )\n\t\t);\n\t\tvec2 alpha = vec2(\n\t\t\thash3D( floor( pixScales.x * position.xyz ) ),\n\t\t\thash3D( floor( pixScales.y * position.xyz ) )\n\t\t);\n\t\tfloat lerpFactor = fract( log2( pixScale ) );\n\t\tfloat x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n\t\tfloat a = min( lerpFactor, 1.0 - lerpFactor );\n\t\tvec3 cases = vec3(\n\t\t\tx * x / ( 2.0 * a * ( 1.0 - a ) ),\n\t\t\t( x - 0.5 * a ) / ( 1.0 - a ),\n\t\t\t1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n\t\t);\n\t\tfloat threshold = ( x < ( 1.0 - a ) )\n\t\t\t? ( ( x < a ) ? cases.x : cases.y )\n\t\t\t: cases.z;\n\t\treturn clamp( threshold , 1.0e-6, 1.0 );\n\t}\n#endif";
13843 var alphamap_fragment =
"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif";
13847 var alphatest_fragment =
"#ifdef USE_ALPHATEST\n\tif ( diffuseColor.a < alphaTest ) discard;\n#endif";
13851 var aomap_fragment =
"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_CLEARCOAT ) \n\t\tclearcoatSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_SHEEN ) \n\t\tsheenSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif";
13853 var aomap_pars_fragment =
"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif";
13855 var batching_pars_vertex =
"#ifdef USE_BATCHING\n\tattribute float batchId;\n\tuniform highp sampler2D batchingTexture;\n\tmat4 getBatchingMatrix( const in float i ) {\n\t\tint size = textureSize( batchingTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n#endif";
13857 var batching_vertex =
"#ifdef USE_BATCHING\n\tmat4 batchingMatrix = getBatchingMatrix( batchId );\n#endif";
13859 var begin_vertex =
"vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n\tvPosition = vec3( position );\n#endif";
13861 var beginnormal_vertex =
"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif";
13863 var bsdfs =
"float G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n} // validated";
13865 var iridescence_fragment =
"#ifdef USE_IRIDESCENCE\n\tconst mat3 XYZ_TO_REC709 = mat3(\n\t\t 3.2404542, -0.9692660, 0.0556434,\n\t\t-1.5371385, 1.8760108, -0.2040259,\n\t\t-0.4985314, 0.0415560, 1.0572252\n\t);\n\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n\t}\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n\t}\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n\t}\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\n\t\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\n\t\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n\t\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n\t\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n\t\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n\t\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n\t\txyz /= 1.0685e-7;\n\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\n\t\treturn rgb;\n\t}\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n\t\tvec3 I;\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\t\tif ( cosTheta2Sq < 0.0 ) {\n\t\t\treturn vec3( 1.0 );\n\t\t}\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\n\t\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n\t\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\n\t\tfloat T121 = 1.0 - R12;\n\t\tfloat phi12 = 0.0;\n\t\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\n\t\tfloat phi21 = PI - phi12;\n\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\t\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n\t\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n\t\tvec3 phi23 = vec3( 0.0 );\n\t\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n\t\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n\t\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n\t\tvec3 phi = vec3( phi21 ) + phi23;\n\t\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n\t\tvec3 r123 = sqrt( R123 );\n\t\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n\t\tvec3 C0 = R12 + Rs;\n\t\tI = C0;\n\t\tvec3 Cm = Rs - T121;\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\n\t\t\tCm *= r123;\n\t\t\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n\t\t\tI += Cm * Sm;\n\t\t}\n\t\treturn max( I, vec3( 0.0 ) );\n\t}\n#endif";
13867 var bumpmap_pars_fragment =
"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vBumpMapUv );\n\t\tvec2 dSTdy = dFdy( vBumpMapUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\n\t\tvec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif";
13869 var clipping_planes_fragment =
"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif";
13871 var clipping_planes_pars_fragment =
"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif";
13877 var color_fragment =
"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif";
13879 var color_pars_fragment =
"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif";
13881 var color_pars_vertex =
"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif";
13883 var color_vertex =
"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif";
13885 var common =
"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat luminance( const in vec3 rgb ) {\n\tconst vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\n\treturn dot( weights, rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated";
13887 var cube_uv_reflection_fragment =
"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif";
13889 var defaultnormal_vertex =
"vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n\tmat3 bm = mat3( batchingMatrix );\n\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n\ttransformedNormal = bm * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = bm * transformedTangent;\n\t#endif\n#endif\n#ifdef USE_INSTANCING\n\tmat3 im = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n\ttransformedNormal = im * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = im * transformedTangent;\n\t#endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif";
13891 var displacementmap_pars_vertex =
"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif";
13893 var displacementmap_vertex =
"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif";
13895 var emissivemap_fragment =
"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif";
13901 var colorspace_pars_fragment =
"\nconst mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(\n\tvec3( 0.8224621, 0.177538, 0.0 ),\n\tvec3( 0.0331941, 0.9668058, 0.0 ),\n\tvec3( 0.0170827, 0.0723974, 0.9105199 )\n);\nconst mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.2249401, - 0.2249404, 0.0 ),\n\tvec3( - 0.0420569, 1.0420571, 0.0 ),\n\tvec3( - 0.0196376, - 0.0786361, 1.0982735 )\n);\nvec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {\n\treturn vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );\n}\nvec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {\n\treturn vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );\n}\nvec4 LinearTransferOETF( in vec4 value ) {\n\treturn value;\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn sRGBTransferOETF( value );\n}";
13903 var envmap_fragment =
"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif";
13905 var envmap_common_pars_fragment =
"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif";
13907 var envmap_pars_fragment =
"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif";
13909 var envmap_pars_vertex =
"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif";
13911 var envmap_vertex =
"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif";
13913 var fog_vertex =
"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif";
13917 var fog_fragment =
"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif";
13919 var fog_pars_fragment =
"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif";
13921 var gradientmap_pars_fragment =
"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}";
13923 var lightmap_fragment =
"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\treflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif";
13925 var lightmap_pars_fragment =
"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif";
13927 var lights_lambert_fragment =
"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;";
13929 var lights_lambert_pars_fragment =
"varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert";
13931 var lights_pars_begin =
"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n\tuniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t#if defined ( LEGACY_LIGHTS )\n\t\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\t\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t\t}\n\t\treturn 1.0;\n\t#else\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tif ( cutoffDistance > 0.0 ) {\n\t\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t}\n\t\treturn distanceFalloff;\n\t#endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif";
13933 var envmap_physical_pars_fragment =
"#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\t#ifdef USE_ANISOTROPY\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\t\t\t#else\n\t\t\t\treturn vec3( 0.0 );\n\t\t\t#endif\n\t\t}\n\t#endif\n#endif";
13937 var lights_toon_pars_fragment =
"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon";
13939 var lights_phong_fragment =
"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;";
13941 var lights_phong_pars_fragment =
"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong";
13943 var lights_physical_fragment =
"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tif( material.anisotropy == 0.0 ) {\n\t\tanisotropyV = vec2( 1.0, 0.0 );\n\t} else {\n\t\tanisotropyV /= material.anisotropy;\n\t\tmaterial.anisotropy = saturate( material.anisotropy );\n\t}\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif";
13945 var lights_physical_pars_fragment =
"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}";
13947 var lights_fragment_begin =
"\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n\tgeometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometryPosition, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if defined( USE_LIGHT_PROBES )\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif";
13949 var lights_fragment_maps =
"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometryNormal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef USE_ANISOTROPY\n\t\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif";
13951 var lights_fragment_end =
"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif";
13953 var logdepthbuf_fragment =
"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif";
13955 var logdepthbuf_pars_fragment =
"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif";
13957 var logdepthbuf_pars_vertex =
"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif";
13959 var logdepthbuf_vertex =
"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif";
13961 var map_fragment =
"#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n\t\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif";
13965 var map_particle_fragment =
"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t#if defined( USE_POINTS_UV )\n\t\tvec2 uv = vUv;\n\t#else\n\t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif";
13967 var map_particle_pars_fragment =
"#if defined( USE_POINTS_UV )\n\tvarying vec2 vUv;\n#else\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t\tuniform mat3 uvTransform;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif";
13969 var metalnessmap_fragment =
"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif";
13973 var morphcolor_vertex =
"#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif";
13975 var morphnormal_vertex =
"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\t\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\t\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\t\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n\t#endif\n#endif";
13977 var morphtarget_pars_vertex =
"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t\tuniform sampler2DArray morphTargetsTexture;\n\t\tuniform ivec2 morphTargetsTextureSize;\n\t\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t\t}\n\t#else\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\tuniform float morphTargetInfluences[ 8 ];\n\t\t#else\n\t\t\tuniform float morphTargetInfluences[ 4 ];\n\t\t#endif\n\t#endif\n#endif";
13979 var morphtarget_vertex =
"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\t\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\t\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\t\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t\t#endif\n\t#endif\n#endif";
13981 var normal_fragment_begin =
"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 nonPerturbedNormal = normal;";
13983 var normal_fragment_maps =
"#ifdef USE_NORMALMAP_OBJECTSPACE\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif";
13985 var normal_pars_fragment =
"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif";
13987 var normal_pars_vertex =
"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif";
13989 var normal_vertex =
"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif";
13991 var normalmap_pars_fragment =
"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif";
13995 var clearcoat_normal_fragment_maps =
"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif";
13997 var clearcoat_pars_fragment =
"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif";
13999 var iridescence_pars_fragment =
"#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif";
14001 var opaque_fragment =
"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );";
14003 var packing =
"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec2 packDepthToRG( in highp float v ) {\n\treturn packDepthToRGBA( v ).yx;\n}\nfloat unpackRGToDepth( const in highp vec2 v ) {\n\treturn unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * depth - far );\n}";
14007 var project_vertex =
"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n\tmvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;";
14009 var dithering_fragment =
"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif";
14011 var dithering_pars_fragment =
"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif";
14013 var roughnessmap_fragment =
"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\troughnessFactor *= texelRoughness.g;\n#endif";
14017 var shadowmap_pars_fragment =
"#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif";
14019 var shadowmap_pars_vertex =
"#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif";
14021 var shadowmap_vertex =
"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\tvec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n#endif";
14023 var shadowmask_pars_fragment =
"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}";
14025 var skinbase_vertex =
"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif";
14027 var skinning_pars_vertex =
"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tint size = textureSize( boneTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n#endif";
14029 var skinning_vertex =
"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif";
14031 var skinnormal_vertex =
"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif";
14033 var specularmap_fragment =
"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif";
14037 var tonemapping_fragment =
"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif";
14039 var tonemapping_pars_fragment =
"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.6605, - 0.1246, - 0.0182 ),\n\tvec3( - 0.5876, 1.1329, - 0.1006 ),\n\tvec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n\tvec3( 0.6274, 0.0691, 0.0164 ),\n\tvec3( 0.3293, 0.9195, 0.0880 ),\n\tvec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n\tvec3 x2 = x * x;\n\tvec3 x4 = x2 * x2;\n\treturn + 15.5 * x4 * x2\n\t\t- 40.14 * x4 * x\n\t\t+ 31.96 * x4\n\t\t- 6.868 * x2 * x\n\t\t+ 0.4298 * x2\n\t\t+ 0.1191 * x\n\t\t- 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n\tconst mat3 AgXInsetMatrix = mat3(\n\t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n\t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n\t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n\t);\n\tconst mat3 AgXOutsetMatrix = mat3(\n\t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n\t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n\t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n\t);\n\tconst float AgxMinEv = - 12.47393;\tconst float AgxMaxEv = 4.026069;\n\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\tcolor *= toneMappingExposure;\n\tcolor = AgXInsetMatrix * color;\n\tcolor = max( color, 1e-10 );\tcolor = log2( color );\n\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n\tcolor = clamp( color, 0.0, 1.0 );\n\tcolor = agxDefaultContrastApprox( color );\n\tcolor = AgXOutsetMatrix * color;\n\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n\treturn color;\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }";
14041 var transmission_fragment =
"#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif";
14043 var transmission_pars_fragment =
"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\t\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\tvec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\t}\n#endif";
14045 var uv_pars_fragment =
"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif";
14047 var uv_pars_vertex =
"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tuniform mat3 anisotropyMapTransform;\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif";
14049 var uv_vertex =
"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif";
14051 var worldpos_vertex =
"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_BATCHING\n\t\tworldPosition = batchingMatrix * worldPosition;\n\t#endif\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif";
14053 const vertex$h =
"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}";
14055 const fragment$h =
"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}";
14057 const vertex$g =
"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}";
14059 const fragment$g =
"#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}";
14061 const vertex$f =
"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}";
14063 const fragment$f =
"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}";
14065 const vertex$e =
"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}";
14067 const fragment$e =
"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}";
14069 const vertex$d =
"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}";
14071 const fragment$d =
"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}";
14073 const vertex$c =
"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}";
14075 const fragment$c =
"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}";
14077 const vertex$b =
"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}";
14079 const fragment$b =
"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}";
14081 const vertex$a =
"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}";
14083 const fragment$a =
"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
14085 const vertex$9 =
"#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
14087 const fragment$9 =
"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_lambert_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
14089 const vertex$8 =
"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}";
14091 const fragment$8 =
"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
14093 const vertex$7 =
"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}";
14095 const fragment$7 =
"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}";
14097 const vertex$6 =
"#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
14099 const fragment$6 =
"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
14101 const vertex$5 =
"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}";
14103 const fragment$5 =
"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\t#endif\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
14105 const vertex$4 =
"#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
14107 const fragment$4 =
"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
14109 const vertex$3 =
"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#ifdef USE_POINTS_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}";
14111 const fragment$3 =
"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}";
14113 const vertex$2 =
"#include <common>\n#include <batching_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
14115 const fragment$2 =
"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <logdepthbuf_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}";
14117 const vertex$1 =
"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}";
14119 const fragment$1 =
"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}";
14524 emissive: { value: new Color( 0x000000 ) }
14548 emissive: { value: new Color( 0x000000 ) },
14575 emissive: { value: new Color( 0x000000 ) },
14601 emissive: { value: new Color( 0x000000 ) }
14619 matcap: { value: null }
14646 scale: { value: 1 },
14677 opacity: { value: 1.0 }
14755 referencePosition: { value: new Vector3() },
14772 color: { value: new Color( 0x00000 ) },
14789 clearcoat: { value: 0 },
14840 const _rgb = {
r: 0,
b: 0,
g: 0 };
14891 renderer.clear( renderer.autoClearColor, renderer.autoClearDepth, renderer.autoClearStencil );
14902 name:
'BackgroundCubeMaterial',
14913 boxMesh.geometry.deleteAttribute(
'normal' );
14914 boxMesh.geometry.deleteAttribute(
'uv' );
14918 this.matrixWorld.copyPosition(
camera.matrixWorld );
14927 return this.uniforms.envMap.value;
14939 boxMesh.material.uniforms.backgroundBlurriness.value =
scene.backgroundBlurriness;
14940 boxMesh.material.uniforms.backgroundIntensity.value =
scene.backgroundIntensity;
14947 boxMesh.material.needsUpdate =
true;
14967 name:
'BackgroundMaterial',
14978 planeMesh.geometry.deleteAttribute(
'normal' );
14985 return this.uniforms.t2D.value;
14996 planeMesh.material.uniforms.backgroundIntensity.value =
scene.backgroundIntensity;
14999 if (
background.matrixAutoUpdate ===
true ) {
15117 if (
index !==
null ) {
15129 if (
index !==
null ) {
15143 return extension.createVertexArrayOES();
15375 gl.disableVertexAttribArray(
i );
15400 if (
capabilities.isWebGL2 ===
false && (
object.isInstancedMesh ||
geometry.isInstancedBufferGeometry ) ) {
15402 if (
extensions.get(
'ANGLE_instanced_arrays' ) ===
null )
return;
15454 if (
data.isInstancedInterleavedBuffer ) {
15544 switch (
value.length ) {
15732 console.error(
'THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.' );
15792 if (
extensions.has(
'EXT_texture_filter_anisotropic' ) ===
true ) {
15812 if (
gl.getShaderPrecisionFormat(
gl.VERTEX_SHADER,
gl.HIGH_FLOAT ).precision > 0 &&
15813 gl.getShaderPrecisionFormat(
gl.FRAGMENT_SHADER,
gl.HIGH_FLOAT ).precision > 0 ) {
15825 if (
gl.getShaderPrecisionFormat(
gl.VERTEX_SHADER,
gl.MEDIUM_FLOAT ).precision > 0 &&
15826 gl.getShaderPrecisionFormat(
gl.FRAGMENT_SHADER,
gl.MEDIUM_FLOAT ).precision > 0 ) {
15904 const scope =
this;
16009 if (
uniform.value !== globalState ) {
16017 scope.numIntersection = 0;
16060 scope.numIntersection = 0;
16135 const texture =
event.target;
16171 this.type =
'OrthographicCamera';
16192 this.left =
source.left;
16199 this.zoom =
source.zoom;
16208 if ( this.
view ===
null ) {
16222 this.
view.enabled =
true;
16225 this.
view.offsetX =
x;
16226 this.
view.offsetY =
y;
16236 if ( this.
view !==
null ) {
16238 this.
view.enabled =
false;
16248 const dx = ( this.
right - this.
left ) / ( 2 * this.zoom );
16249 const dy = ( this.top - this.
bottom ) / ( 2 * this.zoom );
16251 const cy = ( this.top + this.
bottom ) / 2;
16258 if ( this.
view !==
null && this.
view.enabled ) {
16260 const scaleW = ( this.right - this.
left ) / this.
view.fullWidth /
this.zoom;
16261 const scaleH = ( this.top - this.
bottom ) / this.
view.fullHeight /
this.zoom;
16280 data.object.zoom = this.zoom;
16315 const PHI = ( 1 +
Math.sqrt( 5 ) ) / 2;
16378 _oldActiveCubeFace = this.
_renderer.getActiveCubeFace();
16379 _oldActiveMipmapLevel = this.
_renderer.getActiveMipmapLevel();
16510 _oldTarget = this.
_renderer.getRenderTarget();
16511 _oldActiveCubeFace = this.
_renderer.getActiveCubeFace();
16512 _oldActiveMipmapLevel = this.
_renderer.getActiveMipmapLevel();
16573 const upSign = [ 1, - 1, 1, 1, 1, 1 ];
16582 renderer.autoClear =
false;
16585 name:
'PMREM.Background',
16601 scene.background =
null;
16613 for (
let i = 0;
i < 6;
i ++ ) {
16622 }
else if (
col === 1 ) {
16688 const uniforms =
material.uniforms;
16705 renderer.autoClear =
false;
16760 'blur direction must be either latitudinal or longitudinal!' );
16859 }
else if (
i === 0 ) {
16870 const uv1 = [
min,
min,
max,
min,
max,
max,
min,
min,
max,
max,
min,
max ];
16884 const x = (
face % 3 ) * 2 / 3 - 1;
16885 const y =
face > 2 ? 0 : - 1;
16889 x + 2 / 3,
y + 1, 0,
16891 x + 2 / 3,
y + 1, 0,
16942 name:
'SphericalGaussianBlur',
16946 'CUBEUV_TEXEL_WIDTH': 1.0 /
width,
16947 'CUBEUV_TEXEL_HEIGHT': 1.0 /
height,
16948 'CUBEUV_MAX_MIP': `
${
lodMax}.0`,
16952 'envMap': {
value:
null },
16953 'samples': {
value: 1 },
16955 'latitudinal': {
value:
false },
16956 'dTheta': {
value: 0 },
16957 'mipInt': {
value: 0 },
16978 #define ENVMAP_TYPE_CUBE_UV
16979 #include <cube_uv_reflection_fragment>
17008 for (
int i = 1;
i <
n;
i++ ) {
17039 name:
'EquirectangularToCubeUV',
17042 'envMap': {
value:
null }
17080 name:
'CubemapToCubeUV',
17083 'envMap': {
value:
null },
17084 'flipEnvMap': {
value: - 1 }
17129 uv = 2.0 *
uv - 1.0;
17133 if (
face == 0.0 ) {
17137 }
else if (
face == 1.0 ) {
17142 }
else if (
face == 2.0 ) {
17146 }
else if (
face == 3.0 ) {
17151 }
else if (
face == 4.0 ) {
17156 }
else if (
face == 5.0 ) {
17195 if (
texture.isRenderTargetTexture &&
texture.needsPMREMUpdate ===
true ) {
17197 texture.needsPMREMUpdate =
false;
17267 const texture =
event.target;
17318 case 'WEBGL_depth_texture':
17319 extension =
gl.getExtension(
'WEBGL_depth_texture' ) ||
gl.getExtension(
'MOZ_WEBGL_depth_texture' ) ||
gl.getExtension(
'WEBKIT_WEBGL_depth_texture' );
17322 case 'EXT_texture_filter_anisotropic':
17323 extension =
gl.getExtension(
'EXT_texture_filter_anisotropic' ) ||
gl.getExtension(
'MOZ_EXT_texture_filter_anisotropic' ) ||
gl.getExtension(
'WEBKIT_EXT_texture_filter_anisotropic' );
17326 case 'WEBGL_compressed_texture_s3tc':
17327 extension =
gl.getExtension(
'WEBGL_compressed_texture_s3tc' ) ||
gl.getExtension(
'MOZ_WEBGL_compressed_texture_s3tc' ) ||
gl.getExtension(
'WEBKIT_WEBGL_compressed_texture_s3tc' );
17330 case 'WEBGL_compressed_texture_pvrtc':
17331 extension =
gl.getExtension(
'WEBGL_compressed_texture_pvrtc' ) ||
gl.getExtension(
'WEBKIT_WEBGL_compressed_texture_pvrtc' );
17375 getExtension(
'WEBGL_multisampled_render_to_texture' );
17379 get:
function (
name ) {
17385 console.warn(
'THREE.WebGLRenderer: ' +
name +
' extension not supported.' );
17445 if (
geometry.isInstancedBufferGeometry ===
true ) {
17447 delete geometry._maxInstanceCount;
17453 info.memory.geometries --;
17465 info.memory.geometries ++;
17529 for (
let i = 0,
l = (
array.length / 3 ) - 1;
i <
l;
i += 3 ) {
17650 console.error(
'THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.' );
17732 case gl.LINE_STRIP:
17745 console.error(
'THREE.WebGLInfo: Unknown draw mode:',
mode );
17774 return a[ 0 ] -
b[ 0 ];
17780 return Math.abs(
b[ 1 ] ) -
Math.abs(
a[ 1 ] );
17793 for (
let i = 0;
i < 8;
i ++ ) {
17938 program.getUniforms().setValue(
gl,
'morphTargetsTextureSize',
entry.size );
17979 for (
let i = 0;
i < 8;
i ++ ) {
18002 for (
let i = 0;
i < 8;
i ++ ) {
18029 geometry.deleteAttribute(
'morphTarget' +
i );
18035 geometry.deleteAttribute(
'morphNormal' +
i );
18069 function update(
object ) {
18163 throw new Error(
'DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat' );
18179 this.
flipY =
false;
18314 if (
a.length !==
b.length )
return false;
18316 for (
let i = 0,
l =
a.length;
i <
l;
i ++ ) {
18318 if (
a[
i ] !==
b[
i ] )
return false;
18328 for (
let i = 0,
l =
b.length;
i <
l;
i ++ ) {
18349 for (
let i = 0;
i !==
n; ++
i ) {
18370 if ( cache[ 0 ] ===
v )
return;
18372 gl.uniform1f( this.
addr, v );
18388 gl.uniform2f( this.
addr, v.x,
v.y );
18399 gl.uniform2fv( this.
addr, v );
18415 gl.uniform3f( this.
addr, v.x,
v.y,
v.z );
18427 gl.uniform3f( this.
addr, v.r,
v.g,
v.b );
18439 gl.uniform3fv( this.
addr, v );
18455 gl.uniform4f( this.
addr, v.x,
v.y,
v.z,
v.w );
18468 gl.uniform4fv( this.
addr, v );
18487 gl.uniformMatrix2fv( this.
addr,
false, v );
18514 gl.uniformMatrix3fv( this.
addr,
false, v );
18541 gl.uniformMatrix4fv( this.
addr,
false, v );
18565 if ( cache[ 0 ] ===
v )
return;
18567 gl.uniform1i( this.
addr, v );
18583 gl.uniform2i( this.
addr, v.x,
v.y );
18594 gl.uniform2iv( this.
addr, v );
18610 gl.uniform3i( this.
addr, v.x,
v.y,
v.z );
18622 gl.uniform3iv( this.
addr, v );
18638 gl.uniform4i( this.
addr, v.x,
v.y,
v.z,
v.w );
18651 gl.uniform4iv( this.
addr, v );
18665 if ( cache[ 0 ] ===
v )
return;
18667 gl.uniform1ui( this.
addr, v );
18683 gl.uniform2ui( this.
addr, v.x,
v.y );
18694 gl.uniform2uiv( this.
addr, v );
18710 gl.uniform3ui( this.
addr, v.x,
v.y,
v.z );
18722 gl.uniform3uiv( this.
addr, v );
18738 gl.uniform4ui( this.
addr, v.x,
v.y,
v.z,
v.w );
18751 gl.uniform4uiv( this.
addr, v );
18767 if ( cache[ 0 ] !==
unit ) {
18785 if ( cache[ 0 ] !==
unit ) {
18801 if ( cache[ 0 ] !==
unit ) {
18817 if ( cache[ 0 ] !==
unit ) {
18886 gl.uniform1fv( this.
addr, v );
18922 gl.uniformMatrix2fv( this.
addr,
false,
data );
18930 gl.uniformMatrix3fv( this.
addr,
false,
data );
18938 gl.uniformMatrix4fv( this.
addr,
false,
data );
18946 gl.uniform1iv( this.
addr, v );
18954 gl.uniform2iv( this.
addr, v );
18960 gl.uniform3iv( this.
addr, v );
18966 gl.uniform4iv( this.
addr, v );
18974 gl.uniform1uiv( this.
addr, v );
18982 gl.uniform2uiv( this.
addr, v );
18988 gl.uniform3uiv( this.
addr, v );
18994 gl.uniform4uiv( this.
addr, v );
19005 const n = v.length;
19017 for (
let i = 0;
i !==
n; ++
i ) {
19029 const n = v.length;
19041 for (
let i = 0;
i !==
n; ++
i ) {
19053 const n = v.length;
19065 for (
let i = 0;
i !==
n; ++
i ) {
19077 const n = v.length;
19089 for (
let i = 0;
i !==
n; ++
i ) {
19201 for (
let i = 0,
n =
seq.length;
i !==
n; ++
i ) {
19203 const u =
seq[
i ];
19294 const n =
gl.getProgramParameter(
program,
gl.ACTIVE_UNIFORMS );
19296 for (
let i = 0;
i <
n; ++
i ) {
19317 const v =
object[
name ];
19325 for (
let i = 0,
n =
seq.length;
i !==
n; ++
i ) {
19327 const u =
seq[
i ],
19330 if (
v.needsUpdate !==
false ) {
19345 for (
let i = 0,
n =
seq.length;
i !==
n; ++
i ) {
19347 const u =
seq[
i ];
19360 const shader =
gl.createShader( type );
19362 gl.shaderSource(
shader,
string );
19376 const lines =
string.split(
'\n' );
19384 const line =
i + 1;
19389 return lines2.join(
'\n' );
19519 parameters.extensionClipCullDistance ?
'#extension GL_ANGLE_clip_cull_distance : require' :
''
19534 if (
value ===
false )
continue;
19540 return chunks.join(
'\n' );
19548 const n =
gl.getProgramParameter(
program,
gl.ACTIVE_ATTRIBUTES );
19550 for (
let i = 0;
i <
n;
i ++ ) {
19576 return string !==
'';
19618 [
'encodings_fragment',
'colorspace_fragment' ],
19619 [
'encodings_pars_fragment',
'colorspace_pars_fragment' ],
19620 [
'output_fragment',
'opaque_fragment' ],
19634 console.warn(
'THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',
include,
newInclude );
19638 throw new Error(
'Can not resolve #include <' +
include +
'>' );
19665 .replace( /\[\
s*
i\
s*\]/
g,
'[ ' +
i +
' ]' )
19684 }
else if (
parameters.precision ===
'mediump' ) {
19688 }
else if (
parameters.precision ===
'lowp' ) {
19815 const gl = renderer.getContext();
19843 '#define SHADER_TYPE ' +
parameters.shaderType,
19844 '#define SHADER_NAME ' +
parameters.shaderName,
19860 '#define SHADER_TYPE ' +
parameters.shaderType,
19861 '#define SHADER_NAME ' +
parameters.shaderName,
19879 '#define SHADER_TYPE ' +
parameters.shaderType,
19880 '#define SHADER_NAME ' +
parameters.shaderName,
19884 parameters.extensionClipCullDistance ?
'#define USE_CLIP_DISTANCE' :
'',
19885 parameters.batching ?
'#define USE_BATCHING' :
'',
19886 parameters.instancing ?
'#define USE_INSTANCING' :
'',
19887 parameters.instancingColor ?
'#define USE_INSTANCING_COLOR' :
'',
19893 parameters.envMap ?
'#define USE_ENVMAP' :
'',
19895 parameters.lightMap ?
'#define USE_LIGHTMAP' :
'',
19896 parameters.aoMap ?
'#define USE_AOMAP' :
'',
19897 parameters.bumpMap ?
'#define USE_BUMPMAP' :
'',
19898 parameters.normalMap ?
'#define USE_NORMALMAP' :
'',
19899 parameters.normalMapObjectSpace ?
'#define USE_NORMALMAP_OBJECTSPACE' :
'',
19900 parameters.normalMapTangentSpace ?
'#define USE_NORMALMAP_TANGENTSPACE' :
'',
19901 parameters.displacementMap ?
'#define USE_DISPLACEMENTMAP' :
'',
19902 parameters.emissiveMap ?
'#define USE_EMISSIVEMAP' :
'',
19904 parameters.anisotropy ?
'#define USE_ANISOTROPY' :
'',
19905 parameters.anisotropyMap ?
'#define USE_ANISOTROPYMAP' :
'',
19907 parameters.clearcoatMap ?
'#define USE_CLEARCOATMAP' :
'',
19908 parameters.clearcoatRoughnessMap ?
'#define USE_CLEARCOAT_ROUGHNESSMAP' :
'',
19909 parameters.clearcoatNormalMap ?
'#define USE_CLEARCOAT_NORMALMAP' :
'',
19911 parameters.iridescenceMap ?
'#define USE_IRIDESCENCEMAP' :
'',
19912 parameters.iridescenceThicknessMap ?
'#define USE_IRIDESCENCE_THICKNESSMAP' :
'',
19914 parameters.specularMap ?
'#define USE_SPECULARMAP' :
'',
19915 parameters.specularColorMap ?
'#define USE_SPECULAR_COLORMAP' :
'',
19916 parameters.specularIntensityMap ?
'#define USE_SPECULAR_INTENSITYMAP' :
'',
19918 parameters.roughnessMap ?
'#define USE_ROUGHNESSMAP' :
'',
19919 parameters.metalnessMap ?
'#define USE_METALNESSMAP' :
'',
19920 parameters.alphaMap ?
'#define USE_ALPHAMAP' :
'',
19921 parameters.alphaHash ?
'#define USE_ALPHAHASH' :
'',
19923 parameters.transmission ?
'#define USE_TRANSMISSION' :
'',
19924 parameters.transmissionMap ?
'#define USE_TRANSMISSIONMAP' :
'',
19925 parameters.thicknessMap ?
'#define USE_THICKNESSMAP' :
'',
19927 parameters.sheenColorMap ?
'#define USE_SHEEN_COLORMAP' :
'',
19928 parameters.sheenRoughnessMap ?
'#define USE_SHEEN_ROUGHNESSMAP' :
'',
19939 parameters.displacementMapUv ?
'#define DISPLACEMENTMAP_UV ' +
parameters.displacementMapUv :
'',
19947 parameters.clearcoatNormalMapUv ?
'#define CLEARCOAT_NORMALMAP_UV ' +
parameters.clearcoatNormalMapUv :
'',
19948 parameters.clearcoatRoughnessMapUv ?
'#define CLEARCOAT_ROUGHNESSMAP_UV ' +
parameters.clearcoatRoughnessMapUv :
'',
19950 parameters.iridescenceMapUv ?
'#define IRIDESCENCEMAP_UV ' +
parameters.iridescenceMapUv :
'',
19951 parameters.iridescenceThicknessMapUv ?
'#define IRIDESCENCE_THICKNESSMAP_UV ' +
parameters.iridescenceThicknessMapUv :
'',
19954 parameters.sheenRoughnessMapUv ?
'#define SHEEN_ROUGHNESSMAP_UV ' +
parameters.sheenRoughnessMapUv :
'',
19957 parameters.specularColorMapUv ?
'#define SPECULAR_COLORMAP_UV ' +
parameters.specularColorMapUv :
'',
19958 parameters.specularIntensityMapUv ?
'#define SPECULAR_INTENSITYMAP_UV ' +
parameters.specularIntensityMapUv :
'',
19960 parameters.transmissionMapUv ?
'#define TRANSMISSIONMAP_UV ' +
parameters.transmissionMapUv :
'',
19966 parameters.vertexColors ?
'#define USE_COLOR' :
'',
19967 parameters.vertexAlphas ?
'#define USE_COLOR_ALPHA' :
'',
19968 parameters.vertexUv1s ?
'#define USE_UV1' :
'',
19969 parameters.vertexUv2s ?
'#define USE_UV2' :
'',
19970 parameters.vertexUv3s ?
'#define USE_UV3' :
'',
19972 parameters.pointsUvs ?
'#define USE_POINTS_UV' :
'',
19974 parameters.flatShading ?
'#define FLAT_SHADED' :
'',
19976 parameters.skinning ?
'#define USE_SKINNING' :
'',
19978 parameters.morphTargets ?
'#define USE_MORPHTARGETS' :
'',
19979 parameters.morphNormals &&
parameters.flatShading ===
false ?
'#define USE_MORPHNORMALS' :
'',
19999 'uniform mat4 modelMatrix;',
20000 'uniform mat4 modelViewMatrix;',
20001 'uniform mat4 projectionMatrix;',
20002 'uniform mat4 viewMatrix;',
20003 'uniform mat3 normalMatrix;',
20004 'uniform vec3 cameraPosition;',
20005 'uniform bool isOrthographic;',
20007 '#ifdef USE_INSTANCING',
20009 ' attribute mat4 instanceMatrix;',
20013 '#ifdef USE_INSTANCING_COLOR',
20015 ' attribute vec3 instanceColor;',
20019 'attribute vec3 position;',
20020 'attribute vec3 normal;',
20021 'attribute vec2 uv;',
20025 ' attribute vec2 uv1;',
20031 ' attribute vec2 uv2;',
20037 ' attribute vec2 uv3;',
20041 '#ifdef USE_TANGENT',
20043 ' attribute vec4 tangent;',
20047 '#if defined( USE_COLOR_ALPHA )',
20049 ' attribute vec4 color;',
20051 '#elif defined( USE_COLOR )',
20053 ' attribute vec3 color;',
20057 '#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )',
20059 ' attribute vec3 morphTarget0;',
20060 ' attribute vec3 morphTarget1;',
20061 ' attribute vec3 morphTarget2;',
20062 ' attribute vec3 morphTarget3;',
20064 ' #ifdef USE_MORPHNORMALS',
20066 ' attribute vec3 morphNormal0;',
20067 ' attribute vec3 morphNormal1;',
20068 ' attribute vec3 morphNormal2;',
20069 ' attribute vec3 morphNormal3;',
20073 ' attribute vec3 morphTarget4;',
20074 ' attribute vec3 morphTarget5;',
20075 ' attribute vec3 morphTarget6;',
20076 ' attribute vec3 morphTarget7;',
20082 '#ifdef USE_SKINNING',
20084 ' attribute vec4 skinIndex;',
20085 ' attribute vec4 skinWeight;',
20099 '#define SHADER_TYPE ' +
parameters.shaderType,
20100 '#define SHADER_NAME ' +
parameters.shaderName,
20108 parameters.matcap ?
'#define USE_MATCAP' :
'',
20109 parameters.envMap ?
'#define USE_ENVMAP' :
'',
20116 parameters.lightMap ?
'#define USE_LIGHTMAP' :
'',
20117 parameters.aoMap ?
'#define USE_AOMAP' :
'',
20118 parameters.bumpMap ?
'#define USE_BUMPMAP' :
'',
20119 parameters.normalMap ?
'#define USE_NORMALMAP' :
'',
20120 parameters.normalMapObjectSpace ?
'#define USE_NORMALMAP_OBJECTSPACE' :
'',
20121 parameters.normalMapTangentSpace ?
'#define USE_NORMALMAP_TANGENTSPACE' :
'',
20122 parameters.emissiveMap ?
'#define USE_EMISSIVEMAP' :
'',
20124 parameters.anisotropy ?
'#define USE_ANISOTROPY' :
'',
20125 parameters.anisotropyMap ?
'#define USE_ANISOTROPYMAP' :
'',
20127 parameters.clearcoat ?
'#define USE_CLEARCOAT' :
'',
20128 parameters.clearcoatMap ?
'#define USE_CLEARCOATMAP' :
'',
20129 parameters.clearcoatRoughnessMap ?
'#define USE_CLEARCOAT_ROUGHNESSMAP' :
'',
20130 parameters.clearcoatNormalMap ?
'#define USE_CLEARCOAT_NORMALMAP' :
'',
20132 parameters.iridescence ?
'#define USE_IRIDESCENCE' :
'',
20133 parameters.iridescenceMap ?
'#define USE_IRIDESCENCEMAP' :
'',
20134 parameters.iridescenceThicknessMap ?
'#define USE_IRIDESCENCE_THICKNESSMAP' :
'',
20136 parameters.specularMap ?
'#define USE_SPECULARMAP' :
'',
20137 parameters.specularColorMap ?
'#define USE_SPECULAR_COLORMAP' :
'',
20138 parameters.specularIntensityMap ?
'#define USE_SPECULAR_INTENSITYMAP' :
'',
20140 parameters.roughnessMap ?
'#define USE_ROUGHNESSMAP' :
'',
20141 parameters.metalnessMap ?
'#define USE_METALNESSMAP' :
'',
20143 parameters.alphaMap ?
'#define USE_ALPHAMAP' :
'',
20144 parameters.alphaTest ?
'#define USE_ALPHATEST' :
'',
20145 parameters.alphaHash ?
'#define USE_ALPHAHASH' :
'',
20147 parameters.sheen ?
'#define USE_SHEEN' :
'',
20148 parameters.sheenColorMap ?
'#define USE_SHEEN_COLORMAP' :
'',
20149 parameters.sheenRoughnessMap ?
'#define USE_SHEEN_ROUGHNESSMAP' :
'',
20151 parameters.transmission ?
'#define USE_TRANSMISSION' :
'',
20152 parameters.transmissionMap ?
'#define USE_TRANSMISSIONMAP' :
'',
20153 parameters.thicknessMap ?
'#define USE_THICKNESSMAP' :
'',
20157 parameters.vertexAlphas ?
'#define USE_COLOR_ALPHA' :
'',
20158 parameters.vertexUv1s ?
'#define USE_UV1' :
'',
20159 parameters.vertexUv2s ?
'#define USE_UV2' :
'',
20160 parameters.vertexUv3s ?
'#define USE_UV3' :
'',
20162 parameters.pointsUvs ?
'#define USE_POINTS_UV' :
'',
20164 parameters.gradientMap ?
'#define USE_GRADIENTMAP' :
'',
20166 parameters.flatShading ?
'#define FLAT_SHADED' :
'',
20168 parameters.doubleSided ?
'#define DOUBLE_SIDED' :
'',
20169 parameters.flipSided ?
'#define FLIP_SIDED' :
'',
20171 parameters.shadowMapEnabled ?
'#define USE_SHADOWMAP' :
'',
20174 parameters.premultipliedAlpha ?
'#define PREMULTIPLIED_ALPHA' :
'',
20176 parameters.numLightProbes > 0 ?
'#define USE_LIGHT_PROBES' :
'',
20178 parameters.useLegacyLights ?
'#define LEGACY_LIGHTS' :
'',
20180 parameters.decodeVideoTexture ?
'#define DECODE_VIDEO_TEXTURE' :
'',
20182 parameters.logarithmicDepthBuffer ?
'#define USE_LOGDEPTHBUF' :
'',
20183 (
parameters.logarithmicDepthBuffer &&
parameters.rendererExtensionFragDepth ) ?
'#define USE_LOGDEPTHBUF_EXT' :
'',
20185 'uniform mat4 viewMatrix;',
20186 'uniform vec3 cameraPosition;',
20187 'uniform bool isOrthographic;',
20226 'precision mediump sampler2DArray;',
20227 '#define attribute in',
20228 '#define varying out',
20229 '#define texture2D texture'
20233 'precision mediump sampler2DArray;',
20234 '#define varying in',
20235 (
parameters.glslVersion ===
GLSL3 ) ?
'' :
'layout(location = 0) out highp vec4 pc_fragColor;',
20237 '#define gl_FragDepthEXT gl_FragDepth',
20238 '#define texture2D texture',
20239 '#define textureCube texture',
20240 '#define texture2DProj textureProj',
20241 '#define texture2DLodEXT textureLod',
20242 '#define texture2DProjLodEXT textureProjLod',
20243 '#define textureCubeLodEXT textureLod',
20244 '#define texture2DGradEXT textureGrad',
20245 '#define texture2DProjGradEXT textureProjGrad',
20246 '#define textureCubeGradEXT textureGrad'
20269 }
else if (
parameters.morphTargets ===
true ) {
20272 gl.bindAttribLocation(
program, 0,
'position' );
20281 if ( renderer.debug.checkShaderErrors ) {
20290 if (
gl.getProgramParameter(
program,
gl.LINK_STATUS ) ===
false ) {
20294 if (
typeof renderer.debug.onShaderError ===
'function' ) {
20306 'THREE.WebGLProgram: Shader Error ' +
gl.getError() +
' - ' +
20307 'VALIDATE_STATUS ' +
gl.getProgramParameter(
program,
gl.VALIDATE_STATUS ) +
'\n\n' +
20327 self.diagnostics = {
20390 if ( cachedAttributes ===
undefined ) {
20408 if ( programReady ===
false ) {
20422 bindingStates.releaseStatesOfProgram(
this );
20432 this.
name = parameters.shaderName;
20433 this.
id = programIdCount ++;
20457 const vertexShader =
material.vertexShader;
20558 this.
id = _id$1 ++;
20599 if (
value === 0 )
return 'uv';
20619 if (
material.precision !==
null ) {
20625 console.warn(
'THREE.WebGLProgram.getParameters:',
material.precision,
'not supported, using',
precision,
'instead.' );
20958 if (
parameters.isRawShaderMaterial ===
false ) {
20962 array.push( renderer.outputColorSpace );
20968 return array.join();
21171 if ( --
program.usedTimes === 0 ) {
21215 function get(
object ) {
21217 let map = properties.get(
object );
21222 properties.set(
object,
map );
21230 function remove(
object ) {
21232 properties.delete(
object );
21238 properties.get(
object )[
key ] =
value;
21259 if (
a.groupOrder !==
b.groupOrder ) {
21261 return a.groupOrder -
b.groupOrder;
21263 }
else if (
a.renderOrder !==
b.renderOrder ) {
21265 return a.renderOrder -
b.renderOrder;
21267 }
else if (
a.material.id !==
b.material.id ) {
21269 return a.material.id -
b.material.id;
21271 }
else if (
a.z !==
b.z ) {
21277 return a.id -
b.id;
21285 if (
a.groupOrder !==
b.groupOrder ) {
21287 return a.groupOrder -
b.groupOrder;
21289 }
else if (
a.renderOrder !==
b.renderOrder ) {
21291 return a.renderOrder -
b.renderOrder;
21293 }
else if (
a.z !==
b.z ) {
21299 return a.id -
b.id;
21351 renderItem.renderOrder =
object.renderOrder;
21367 if (
material.transmission > 0.0 ) {
21371 }
else if (
material.transparent ===
true ) {
21387 if (
material.transmission > 0.0 ) {
21391 }
else if (
material.transparent ===
true ) {
21499 get:
function (
light ) {
21509 switch (
light.type ) {
21511 case 'DirectionalLight':
21539 case 'HemisphereLight':
21547 case 'RectAreaLight':
21574 get:
function (
light ) {
21584 switch (
light.type ) {
21586 case 'DirectionalLight':
21696 let r = 0,
g = 0,
b = 0;
21698 for (
let i = 0;
i < 9;
i ++ )
state.probe[
i ].set( 0, 0, 0 );
21730 if (
light.isAmbientLight ) {
21736 }
else if (
light.isLightProbe ) {
21738 for (
let j = 0;
j < 9;
j ++ ) {
21746 }
else if (
light.isDirectionalLight ) {
21752 if (
light.castShadow ) {
21775 }
else if (
light.isSpotLight ) {
21779 uniforms.position.setFromMatrixPosition(
light.matrixWorld );
21807 if (
light.castShadow ) {
21825 }
else if (
light.isRectAreaLight ) {
21838 }
else if (
light.isPointLight ) {
21846 if (
light.castShadow ) {
21871 }
else if (
light.isHemisphereLight ) {
21892 if (
extensions.has(
'OES_texture_float_linear' ) ===
true ) {
21908 if (
extensions.has(
'OES_texture_float_linear' ) ===
true ) {
21913 }
else if (
extensions.has(
'OES_texture_half_float_linear' ) ===
true ) {
21920 console.error(
'THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.' );
21997 if (
light.isDirectionalLight ) {
22001 uniforms.direction.setFromMatrixPosition(
light.matrixWorld );
22002 vector3.setFromMatrixPosition(
light.target.matrixWorld );
22008 }
else if (
light.isSpotLight ) {
22012 uniforms.position.setFromMatrixPosition(
light.matrixWorld );
22015 uniforms.direction.setFromMatrixPosition(
light.matrixWorld );
22016 vector3.setFromMatrixPosition(
light.target.matrixWorld );
22022 }
else if (
light.isRectAreaLight ) {
22026 uniforms.position.setFromMatrixPosition(
light.matrixWorld );
22043 }
else if (
light.isPointLight ) {
22047 uniforms.position.setFromMatrixPosition(
light.matrixWorld );
22052 }
else if (
light.isHemisphereLight ) {
22056 uniforms.direction.setFromMatrixPosition(
light.matrixWorld );
22186 this.type =
'MeshDepthMaterial';
22236 this.type =
'MeshDistanceMaterial';
22268 const vertex =
"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}";
22270 const fragment =
"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}";
22306 shadowMaterialHorizontal.defines.HORIZONTAL_PASS = 1;
22312 new Float32Array( [ - 1, - 1, 0.5, 3, - 1, 0.5, - 1, 3, 0.5 ] ),
22319 const scope =
this;
22331 if (
scope.enabled ===
false )
return;
22332 if (
scope.autoUpdate ===
false &&
scope.needsUpdate ===
false )
return;
22334 if (
lights.length === 0 )
return;
22344 _state.buffers.color.setClear( 1, 1, 1, 1 );
22345 _state.buffers.depth.setTest(
true );
22346 _state.setScissorTest(
false );
22362 console.warn(
'THREE.WebGLShadowMap:',
light,
'has no shadow.' );
22367 if (
shadow.autoUpdate ===
false &&
shadow.needsUpdate ===
false )
continue;
22401 if (
shadow.map !==
null ) {
22408 shadow.map.texture.name =
light.name +
'.shadowMap';
22410 shadow.camera.updateProjectionMatrix();
22448 shadow.needsUpdate =
false;
22454 scope.needsUpdate =
false;
22474 if (
shadow.mapPass ===
null ) {
22577 if (
light.isPointLight ===
true &&
result.isMeshDistanceMaterial ===
true ) {
22590 if (
object.
visible ===
false )
return;
22598 object.modelViewMatrix.multiplyMatrices(
shadowCamera.matrixWorldInverse,
object.matrixWorld );
22664 const uuid =
event.target.uuid;
22723 gl.clearColor(
r,
g,
b,
a );
22730 reset:
function () {
22786 gl.depthFunc(
gl.NEVER );
22791 gl.depthFunc(
gl.ALWAYS );
22796 gl.depthFunc(
gl.LESS );
22801 gl.depthFunc(
gl.LEQUAL );
22806 gl.depthFunc(
gl.EQUAL );
22811 gl.depthFunc(
gl.GEQUAL );
22816 gl.depthFunc(
gl.GREATER );
22821 gl.depthFunc(
gl.NOTEQUAL );
22826 gl.depthFunc(
gl.LEQUAL );
22853 reset:
function () {
22960 reset:
function () {
23016 const maxTextures =
gl.getParameter(
gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS );
23022 if (
glVersion.indexOf(
'WebGL' ) !== - 1 ) {
23027 }
else if (
glVersion.indexOf(
'OpenGL ES' ) !== - 1 ) {
23049 gl.texParameteri( type,
gl.TEXTURE_MIN_FILTER,
gl.NEAREST );
23050 gl.texParameteri( type,
gl.TEXTURE_MAG_FILTER,
gl.NEAREST );
23054 if (
isWebGL2 && ( type ===
gl.TEXTURE_3D || type ===
gl.TEXTURE_2D_ARRAY ) ) {
23132 if (
target ===
gl.DRAW_FRAMEBUFFER ) {
23138 if (
target ===
gl.FRAMEBUFFER ) {
23316 gl.blendEquation(
gl.FUNC_ADD );
23328 gl.blendFuncSeparate(
gl.ONE,
gl.ONE_MINUS_SRC_ALPHA,
gl.ONE,
gl.ONE_MINUS_SRC_ALPHA );
23332 gl.blendFunc(
gl.ONE,
gl.ONE );
23336 gl.blendFuncSeparate(
gl.ZERO,
gl.ONE_MINUS_SRC_COLOR,
gl.ZERO,
gl.ONE );
23340 gl.blendFuncSeparate(
gl.ZERO,
gl.SRC_COLOR,
gl.ZERO,
gl.SRC_ALPHA );
23354 gl.blendFuncSeparate(
gl.SRC_ALPHA,
gl.ONE_MINUS_SRC_ALPHA,
gl.ONE,
gl.ONE_MINUS_SRC_ALPHA );
23358 gl.blendFunc(
gl.SRC_ALPHA,
gl.ONE );
23362 gl.blendFuncSeparate(
gl.ZERO,
gl.ONE_MINUS_SRC_COLOR,
gl.ZERO,
gl.ONE );
23366 gl.blendFunc(
gl.ZERO,
gl.SRC_COLOR );
23466 ?
enable(
gl.SAMPLE_ALPHA_TO_COVERAGE )
23479 gl.frontFace(
gl.CW );
23483 gl.frontFace(
gl.CCW );
23503 gl.cullFace(
gl.BACK );
23507 gl.cullFace(
gl.FRONT );
23511 gl.cullFace(
gl.FRONT_AND_BACK );
23655 }
catch (
error ) {
23669 }
catch (
error ) {
23683 }
catch (
error ) {
23697 }
catch (
error ) {
23711 }
catch (
error ) {
23725 }
catch (
error ) {
23739 }
catch (
error ) {
23753 }
catch (
error ) {
23767 }
catch (
error ) {
23781 }
catch (
error ) {
23859 gl.disable(
gl.BLEND );
23860 gl.disable(
gl.CULL_FACE );
23861 gl.disable(
gl.DEPTH_TEST );
23862 gl.disable(
gl.POLYGON_OFFSET_FILL );
23863 gl.disable(
gl.SCISSOR_TEST );
23864 gl.disable(
gl.STENCIL_TEST );
23865 gl.disable(
gl.SAMPLE_ALPHA_TO_COVERAGE );
23867 gl.blendEquation(
gl.FUNC_ADD );
23868 gl.blendFunc(
gl.ONE,
gl.ZERO );
23869 gl.blendFuncSeparate(
gl.ONE,
gl.ZERO,
gl.ONE,
gl.ZERO );
23870 gl.blendColor( 0, 0, 0, 0 );
23872 gl.colorMask(
true,
true,
true,
true );
23873 gl.clearColor( 0, 0, 0, 0 );
23875 gl.depthMask(
true );
23876 gl.depthFunc(
gl.LESS );
23877 gl.clearDepth( 1 );
23881 gl.stencilOp(
gl.KEEP,
gl.KEEP,
gl.KEEP );
23882 gl.clearStencil( 0 );
23884 gl.cullFace(
gl.BACK );
23885 gl.frontFace(
gl.CCW );
23887 gl.polygonOffset( 0, 0 );
23889 gl.activeTexture(
gl.TEXTURE0 );
23891 gl.bindFramebuffer(
gl.FRAMEBUFFER,
null );
23895 gl.bindFramebuffer(
gl.DRAW_FRAMEBUFFER,
null );
23896 gl.bindFramebuffer(
gl.READ_FRAMEBUFFER,
null );
23900 gl.useProgram(
null );
23904 gl.scissor( 0, 0,
gl.canvas.width,
gl.canvas.height );
23905 gl.viewport( 0, 0,
gl.canvas.width,
gl.canvas.height );
24078 const context =
canvas.getContext(
'2d' );
24081 console.warn(
'THREE.WebGLRenderer: Texture has been resized from (' +
image.width +
'x' +
image.height +
') to (' +
width +
'x' +
height +
').' );
24089 console.warn(
'THREE.WebGLRenderer: Image in DataTexture is too big (' +
image.width +
'x' +
image.height +
').' );
24139 console.warn(
'THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format \'' +
internalFormatName +
'\'' );
24206 return texture.mipmaps.length;
24210 return image.mipmaps.length;
24228 return _gl.NEAREST;
24240 const texture =
event.target;
24246 if (
texture.isVideoTexture ) {
24300 properties.remove(
texture );
24313 info.memory.textures --;
24328 info.memory.textures --;
24340 for (
let i = 0;
i < 6;
i ++ ) {
24395 info.memory.textures --;
24399 properties.remove(
texture[
i ] );
24405 properties.remove(
texture );
24426 console.warn(
'THREE.WebGLTextures: Trying to use ' +
textureUnit +
' texture units while this GPU supports only ' +
capabilities.maxTextures );
24455 return array.join();
24471 if (
image ===
null ) {
24473 console.warn(
'THREE.WebGLRenderer: Texture marked for update but no image data found.' );
24475 }
else if (
image.complete ===
false ) {
24477 console.warn(
'THREE.WebGLRenderer: Texture marked for update but image is incomplete' );
24593 console.warn(
'THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.' );
24602 console.warn(
'THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.' );
24608 if (
texture.compareFunction ) {
24615 if (
extensions.has(
'EXT_texture_filter_anisotropic' ) ===
true ) {
24624 if (
texture.anisotropy > 1 || properties.get(
texture ).__currentAnisotropy ) {
24627 properties.get(
texture ).__currentAnisotropy =
texture.anisotropy;
24676 info.memory.textures ++;
24738 _gl.pixelStorei(
_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,
texture.premultiplyAlpha );
24739 _gl.pixelStorei(
_gl.UNPACK_ALIGNMENT,
texture.unpackAlignment );
24761 if (
texture.isDepthTexture ) {
24791 console.error(
'WebGLRenderer: Floating point depth texture requires WebGL2.' );
24806 console.warn(
'THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture.' );
24826 console.warn(
'THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture.' );
24851 }
else if (
texture.isDataTexture ) {
24881 texture.generateMipmaps =
false;
24903 }
else if (
texture.isCompressedTexture ) {
24905 if (
texture.isCompressedArrayTexture ) {
24923 state.compressedTexSubImage3D(
_gl.TEXTURE_2D_ARRAY,
i, 0, 0, 0,
mipmap.width,
mipmap.height,
image.depth,
glFormat,
mipmap.data, 0, 0 );
24933 console.warn(
'THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()' );
24941 state.texSubImage3D(
_gl.TEXTURE_2D_ARRAY,
i, 0, 0, 0,
mipmap.width,
mipmap.height,
image.depth,
glFormat,
glType,
mipmap.data );
24981 console.warn(
'THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()' );
25003 }
else if (
texture.isDataArrayTexture ) {
25013 state.texSubImage3D(
_gl.TEXTURE_2D_ARRAY, 0, 0, 0, 0,
image.width,
image.height,
image.depth,
glFormat,
glType,
image.data );
25021 }
else if (
texture.isData3DTexture ) {
25031 state.texSubImage3D(
_gl.TEXTURE_3D, 0, 0, 0, 0,
image.width,
image.height,
image.depth,
glFormat,
glType,
image.data );
25039 }
else if (
texture.isFramebufferTexture ) {
25096 texture.generateMipmaps =
false;
25138 if (
texture.image.length !== 6 )
return;
25156 _gl.pixelStorei(
_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,
texture.premultiplyAlpha );
25157 _gl.pixelStorei(
_gl.UNPACK_ALIGNMENT,
texture.unpackAlignment );
25165 for (
let i = 0;
i < 6;
i ++ ) {
25203 for (
let i = 0;
i < 6;
i ++ ) {
25227 console.warn(
'THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()' );
25265 for (
let i = 0;
i < 6;
i ++ ) {
25386 state.bindFramebuffer(
_gl.FRAMEBUFFER,
null );
25490 _gl.bindRenderbuffer(
_gl.RENDERBUFFER,
null );
25498 if (
isCube )
throw new Error(
'Depth Texture with cube render targets is not supported' );
25504 throw new Error(
'renderTarget.depthTexture must be an instance of THREE.DepthTexture' );
25509 if ( ! properties.get(
renderTarget.depthTexture ).__webglTexture ||
25550 throw new Error(
'Unknown depthTexture format' );
25564 if (
isCube )
throw new Error(
'target.depthTexture not supported in Cube render targets' );
25574 for (
let i = 0;
i < 6;
i ++ ) {
25592 state.bindFramebuffer(
_gl.FRAMEBUFFER,
null );
25625 if (
renderTarget.isWebGLMultipleRenderTargets !==
true ) {
25634 info.memory.textures ++;
25648 for (
let i = 0;
i < 6;
i ++ ) {
25700 info.memory.textures ++;
25708 console.warn(
'THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.' );
25740 _gl.bindRenderbuffer(
_gl.RENDERBUFFER,
null );
25749 state.bindFramebuffer(
_gl.FRAMEBUFFER,
null );
25762 for (
let i = 0;
i < 6;
i ++ ) {
25786 state.unbindTexture();
25809 state.unbindTexture();
25823 console.error(
'THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.' );
25852 state.unbindTexture();
25883 state.unbindTexture();
25910 _gl.framebufferRenderbuffer(
_gl.FRAMEBUFFER,
_gl.COLOR_ATTACHMENT0 +
i,
_gl.RENDERBUFFER,
null );
25913 _gl.framebufferTexture2D(
_gl.DRAW_FRAMEBUFFER,
_gl.COLOR_ATTACHMENT0 +
i,
_gl.TEXTURE_2D,
null, 0 );
25972 state.bindFramebuffer(
_gl.READ_FRAMEBUFFER,
null );
25973 state.bindFramebuffer(
_gl.DRAW_FRAMEBUFFER,
null );
26030 const format =
texture.format;
26052 texture.generateMipmaps =
false;
26068 console.warn(
'THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.' );
26076 console.error(
'THREE.WebGLTextures: Unsupported texture color space:',
colorSpace );
26248 return extension.COMPRESSED_RGB_ETC1_WEBGL;
26357 if (
isWebGL2 )
return gl.UNSIGNED_INT_24_8;
26363 return extension.UNSIGNED_INT_24_8_WEBGL;
26391 this.cameras =
array;
26405 this.type =
'Group';
26425 if ( this.
_hand ===
null ) {
26427 this.
_hand =
new Group();
26428 this.
_hand.matrixAutoUpdate =
false;
26429 this.
_hand.visible =
false;
26431 this.
_hand.joints = {};
26460 if ( this.
_grip ===
null ) {
26462 this.
_grip =
new Group();
26463 this.
_grip.matrixAutoUpdate =
false;
26464 this.
_grip.visible =
false;
26465 this.
_grip.hasLinearVelocity =
false;
26467 this.
_grip.hasAngularVelocity =
false;
26484 if ( this.
_grip !==
null ) {
26490 if ( this.
_hand !==
null ) {
26535 if ( this.
_grip !==
null ) {
26537 this.
_grip.visible =
false;
26541 if ( this.
_hand !==
null ) {
26543 this.
_hand.visible =
false;
26561 if (
inputSource &&
frame.session.visibilityState !==
'visible-blurred' ) {
26579 joint.matrixWorldNeedsUpdate =
true;
26600 hand.inputState.pinching =
false;
26609 hand.inputState.pinching =
true;
26611 type:
'pinchstart',
26628 grip.matrixWorldNeedsUpdate =
true;
26632 grip.hasLinearVelocity =
true;
26637 grip.hasLinearVelocity =
false;
26643 grip.hasAngularVelocity =
true;
26644 grip.angularVelocity.copy(
gripPose.angularVelocity );
26648 grip.hasAngularVelocity =
false;
26673 targetRay.matrixWorldNeedsUpdate =
true;
26712 if (
grip !==
null ) {
26718 if (
hand !==
null ) {
26734 const joint =
new Group();
26735 joint.matrixAutoUpdate =
false;
26736 joint.visible =
false;
26755 const scope =
this;
26870 controller.dispatchEvent( { type:
event.type,
data:
event.inputSource } );
26916 scope.isPresenting =
false;
26921 scope.dispatchEvent( { type:
'sessionend' } );
26929 if (
scope.isPresenting ===
true ) {
26931 console.warn(
'THREE.WebXRManager: Cannot change framebuffer scale while presenting.' );
26941 if (
scope.isPresenting ===
true ) {
26943 console.warn(
'THREE.WebXRManager: Cannot change reference space type while presenting.' );
26957 customReferenceSpace =
space;
26991 initialRenderTarget = renderer.getRenderTarget();
27011 if ( (
session.renderState.layers ===
undefined ) || ( renderer.capabilities.isWebGL2 ===
false ) ) {
27025 renderer.setPixelRatio( 1 );
27032 format: RGBAFormat,
27033 type: UnsignedByteType,
27034 colorSpace: renderer.outputColorSpace,
27035 stencilBuffer: attributes.stencil
27065 renderer.setPixelRatio( 1 );
27072 format: RGBAFormat,
27073 type: UnsignedByteType,
27074 depthTexture: new DepthTexture( glProjLayer.textureWidth, glProjLayer.textureHeight, depthType, undefined, undefined, undefined, undefined, undefined, undefined, depthFormat ),
27075 stencilBuffer: attributes.stencil,
27076 colorSpace: renderer.outputColorSpace,
27077 samples: attributes.antialias ? 4 : 0
27089 customReferenceSpace =
null;
27095 scope.isPresenting =
true;
27097 scope.dispatchEvent( { type:
'sessionstart' } );
27107 return session.environmentBlendMode;
27117 for (
let i = 0;
i <
event.removed.length;
i ++ ) {
27122 if (
index >= 0 ) {
27133 for (
let i = 0;
i <
event.added.length;
i ++ ) {
27223 camera.matrixWorldInverse.copy(
camera.matrixWorld ).invert();
27236 camera.projectionMatrixInverse.copy(
camera.projectionMatrix ).invert();
27242 if (
parent ===
null ) {
27252 camera.matrixWorldInverse.copy(
camera.matrixWorld ).invert();
27258 if (
session ===
null )
return;
27290 if (
cameras.length === 2 ) {
27310 if (
parent ===
null ) {
27323 camera.updateMatrixWorld(
true );
27326 camera.projectionMatrixInverse.copy(
cameraXR.projectionMatrixInverse );
27328 if (
camera.isPerspectiveCamera ) {
27345 if ( glProjLayer ===
null &&
glBaseLayer ===
null ) {
27362 if ( glProjLayer !==
null ) {
27385 if (
pose !==
null ) {
27425 renderer.setRenderTargetTextures(
27447 camera.matrix.fromArray(
view.transform.matrix );
27449 camera.projectionMatrix.fromArray(
view.projectionMatrix );
27450 camera.projectionMatrixInverse.copy(
camera.projectionMatrix ).invert();
27487 if (
frame.detectedPlanes ) {
27503 onAnimationFrameCallback =
callback;
27507 this.
dispose =
function () {};
27517 if (
map.matrixAutoUpdate ===
true ) {
27519 map.updateMatrix();
27536 }
else if (
fog.isFogExp2 ) {
27546 if (
material.isMeshBasicMaterial ) {
27550 }
else if (
material.isMeshLambertMaterial ) {
27554 }
else if (
material.isMeshToonMaterial ) {
27559 }
else if (
material.isMeshPhongMaterial ) {
27564 }
else if (
material.isMeshStandardMaterial ) {
27569 if (
material.isMeshPhysicalMaterial ) {
27575 }
else if (
material.isMeshMatcapMaterial ) {
27580 }
else if (
material.isMeshDepthMaterial ) {
27584 }
else if (
material.isMeshDistanceMaterial ) {
27589 }
else if (
material.isMeshNormalMaterial ) {
27593 }
else if (
material.isLineBasicMaterial ) {
27597 if (
material.isLineDashedMaterial ) {
27603 }
else if (
material.isPointsMaterial ) {
27607 }
else if (
material.isSpriteMaterial ) {
27611 }
else if (
material.isShadowMaterial ) {
27616 }
else if (
material.isShaderMaterial ) {
27618 material.uniformsNeedUpdate =
false;
27682 uniforms.normalScale.value.negate();
27911 if (
material.sheenRoughnessMap ) {
27934 if (
material.clearcoatRoughnessMap ) {
27942 if (
material.clearcoatNormalMap ) {
27948 uniforms.clearcoatNormalScale.value.copy(
material.clearcoatNormalScale );
27952 uniforms.clearcoatNormalScale.value.negate();
27964 uniforms.iridescenceThicknessMinimum.value =
material.iridescenceThicknessRange[ 0 ];
27965 uniforms.iridescenceThicknessMaximum.value =
material.iridescenceThicknessRange[ 1 ];
27975 if (
material.iridescenceThicknessMap ) {
27977 uniforms.iridescenceThicknessMap.value =
material.iridescenceThicknessMap;
27985 if (
material.transmission > 0 ) {
28031 if (
material.specularColorMap ) {
28039 if (
material.specularIntensityMap ) {
28063 uniforms.referencePosition.value.setFromMatrixPosition(
light.matrixWorld );
28138 gl.bindBuffer(
gl.UNIFORM_BUFFER,
null );
28158 console.error(
'THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached.' );
28200 }
else if (
value.isMatrix3 ) {
28235 gl.bindBuffer(
gl.UNIFORM_BUFFER,
null );
28376 }
else if (
value.isVector2 ) {
28383 }
else if (
value.isVector3 ||
value.isColor ) {
28387 info.boundary = 16;
28390 }
else if (
value.isVector4 ) {
28394 info.boundary = 16;
28397 }
else if (
value.isMatrix3 ) {
28401 info.boundary = 48;
28404 }
else if (
value.isMatrix4 ) {
28408 info.boundary = 64;
28411 }
else if (
value.isTexture ) {
28413 console.warn(
'THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group.' );
28417 console.warn(
'THREE.WebGLRenderer: Unsupported uniform value type.',
value );
28487 if ( context !==
null ) {
28489 _alpha = context.getContextAttributes().alpha;
28559 const _this =
this;
28630 if ( context !==
null )
return context;
28659 if (
_gl ===
null ) {
28661 const contextNames = [
'webgl2',
'webgl',
'experimental-webgl' ];
28663 if (
_this.isWebGL1Renderer ===
true ) {
28671 if (
_gl ===
null ) {
28675 throw new Error(
'Error creating WebGL context with your selected attributes.' );
28679 throw new Error(
'Error creating WebGL context.' );
28689 console.warn(
'THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163.' );
28697 _gl.getShaderPrecisionFormat =
function () {
28699 return {
'rangeMin': 1,
'rangeMax': 1,
'precision': 1 };
28705 }
catch (
error ) {
28707 console.error(
'THREE.WebGLRenderer: ' +
error.message );
28758 _this.properties = properties;
28776 this.getContext =
function () {
28784 return _gl.getContextAttributes();
28790 const extension =
extensions.get(
'WEBGL_lose_context' );
28797 const extension =
extensions.get(
'WEBGL_lose_context' );
28826 if (
xr.isPresenting ) {
28828 console.warn(
'THREE.WebGLRenderer: Can\'t change size while VR device is presenting.' );
28884 if ( x.isVector4 ) {
28906 if ( x.isVector4 ) {
28940 _transparentSort =
method;
28948 return target.copy(
background.getClearColor() );
28960 return background.getClearAlpha();
29025 bits |=
_gl.COLOR_BUFFER_BIT;
29034 bits |=
_gl.STENCIL_BUFFER_BIT;
29035 this.state.buffers.stencil.setMask( 0
xffffffff );
29045 this.
clear(
true,
false,
false );
29051 this.
clear(
false,
true,
false );
29057 this.
clear(
false,
false,
true );
29065 canvas.removeEventListener(
'webglcontextlost',
onContextLost,
false );
29071 properties.dispose();
29099 event.preventDefault();
29101 console.log(
'THREE.WebGLRenderer: Context Lost.' );
29109 console.log(
'THREE.WebGLRenderer: Context Restored.' );
29131 console.error(
'THREE.WebGLRenderer: A WebGL context could not be created. Reason: ',
event.statusMessage );
29168 if (
material.isShaderMaterial ) {
29184 const frontFaceCW = (
object.isMesh &&
object.matrixWorld.determinant() < 0 );
29195 if (
material.wireframe ===
true ) {
29213 if (
group !==
null ) {
29220 if (
index !==
null ) {
29243 if (
index !==
null ) {
29256 if (
material.wireframe ===
true ) {
29259 renderer.setMode(
_gl.LINES );
29263 renderer.setMode(
_gl.TRIANGLES );
29267 }
else if (
object.
isLine ) {
29277 renderer.setMode(
_gl.LINES );
29281 renderer.setMode(
_gl.LINE_LOOP );
29285 renderer.setMode(
_gl.LINE_STRIP );
29291 renderer.setMode(
_gl.POINTS );
29295 renderer.setMode(
_gl.TRIANGLES );
29307 }
else if (
geometry.isInstancedBufferGeometry ) {
29357 targetScene.traverseVisible(
function (
object ) {
29375 scene.traverseVisible(
function (
object ) {
29397 const materials =
new Set();
29399 scene.traverse(
function (
object ) {
29407 for ( let i = 0; i < material.length; i ++ ) {
29409 const material2 = material[ i ];
29411 prepareMaterial( material2, targetScene, object );
29412 materials.add( material2 );
29447 materials.forEach(
function (
material ) {
29455 materials.delete( material );
29463 if ( materials.size === 0 ) {
29476 if (
extensions.get(
'KHR_parallel_shader_compile' ) !==
null ) {
29525 onAnimationFrameCallback =
callback;
29541 console.error(
'THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.' );
29550 if (
scene.matrixWorldAutoUpdate ===
true )
scene.updateMatrixWorld();
29554 if (
camera.parent ===
null &&
camera.matrixWorldAutoUpdate ===
true )
camera.updateMatrixWorld();
29556 if (
xr.enabled ===
true &&
xr.isPresenting ===
true ) {
29558 if (
xr.cameraAutoUpdate ===
true )
xr.updateCamera(
camera );
29587 if (
_this.sortObjects ===
true ) {
29595 this.info.render.frame ++;
29607 if ( this.info.autoReset ===
true ) this.info.reset();
29618 if (
camera.isArrayCamera ) {
29688 if (
object.
visible ===
false )
return;
29698 }
else if (
object.
isLOD ) {
29702 }
else if (
object.
isLight ) {
29745 if (
object.
boundingSphere ===
null )
object.computeBoundingSphere();
29820 state.buffers.depth.setTest(
true );
29821 state.buffers.depth.setMask(
true );
29822 state.buffers.color.setMask(
true );
29824 state.setPolygonOffset(
false );
29965 object.modelViewMatrix.multiplyMatrices(
camera.matrixWorldInverse,
object.matrixWorld );
30076 uniforms.directionalLightShadows.value =
lights.state.directionalShadow;
30086 uniforms.directionalShadowMap.value =
lights.state.directionalShadowMap;
30087 uniforms.directionalShadowMatrix.value =
lights.state.directionalShadowMatrix;
30092 uniforms.pointShadowMatrix.value =
lights.state.pointShadowMatrix;
30343 if (
material.isMeshPhongMaterial ||
30347 material.isMeshStandardMaterial ||
30376 p_uniforms.setOptional(
_gl,
object,
'bindMatrixInverse' );
30390 console.warn(
'THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required.' );
30463 if (
material.isShaderMaterial &&
material.uniformsNeedUpdate ===
true ) {
30466 material.uniformsNeedUpdate =
false;
30470 if (
material.isSpriteMaterial ) {
30499 console.warn(
'THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.' );
30571 if (
extensions.has(
'WEBGL_multisampled_render_to_texture' ) ===
true ) {
30573 console.warn(
'THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided' );
30610 state.bindFramebuffer(
_gl.FRAMEBUFFER,
null );
30709 if ( ! ( renderTarget &&
renderTarget.isWebGLRenderTarget ) ) {
30711 console.error(
'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.' );
30736 console.error(
'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.' );
30747 console.error(
'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.' );
30783 state.unbindTexture();
30799 _gl.pixelStorei(
_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,
dstTexture.premultiplyAlpha );
30823 state.unbindTexture();
30829 if (
_this.isWebGL1Renderer ) {
30831 console.warn(
'THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.' );
30855 console.warn(
'THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.' );
30861 _gl.pixelStorei(
_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,
dstTexture.premultiplyAlpha );
30872 _gl.pixelStorei(
_gl.UNPACK_ROW_LENGTH,
image.width );
30873 _gl.pixelStorei(
_gl.UNPACK_IMAGE_HEIGHT,
image.height );
30880 _gl.texSubImage3D(
glTarget,
level,
position.x,
position.y,
position.z,
width,
height,
depth,
glFormat,
glType,
image.data );
30884 if (
srcTexture.isCompressedArrayTexture ) {
30886 console.warn(
'THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture.' );
30891 _gl.texSubImage3D(
glTarget,
level,
position.x,
position.y,
position.z,
width,
height,
depth,
glFormat,
glType,
image );
30906 state.unbindTexture();
30912 if ( texture.isCubeTexture ) {
30916 }
else if (
texture.isData3DTexture ) {
30920 }
else if (
texture.isDataArrayTexture ||
texture.isCompressedArrayTexture ) {
30930 state.unbindTexture();
30936 _currentActiveCubeFace = 0;
30969 const gl = this.getContext();
30977 console.warn(
'THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead.' );
30984 console.warn(
'THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead.' );
30991 console.warn(
'THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733.' );
30998 console.warn(
'THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733.' );
31033 color: this.color.getHex(),
31058 return new Fog( this.color, this.
near, this.
far );
31067 color: this.color.getHex(),
31084 this.type =
'Scene';
31086 this.background =
null;
31107 if (
source.background !==
null ) this.background =
source.background.clone();
31126 if ( this.
fog !==
null )
data.object.fog = this.
fog.toJSON();
31160 if (
value ===
true ) this.version ++;
31166 console.warn(
'THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead.' );
31194 this.count =
source.count;
31205 index2 *= attribute.stride;
31229 data.arrayBuffers = {};
31239 if (
data.arrayBuffers[
this.array.buffer._uuid ] ===
undefined ) {
31241 data.arrayBuffers[ this.
array.buffer._uuid ] = this.
array.slice( 0 ).buffer;
31245 const array =
new this.
array.constructor(
data.arrayBuffers[
this.array.buffer._uuid ] );
31266 data.arrayBuffers = {};
31278 if (
data.arrayBuffers[
this.array.buffer._uuid ] ===
undefined ) {
31289 type: this.
array.constructor.name,
31317 return this.
data.count;
31323 return this.
data.array;
31335 for (
let i = 0,
l = this.
data.count; i <
l;
i ++ ) {
31351 for (
let i = 0,
l = this.count;
i <
l;
i ++ ) {
31367 for (
let i = 0,
l = this.count;
i <
l;
i ++ ) {
31395 this.
data.array[ index * this.
data.stride + this.offset + 1 ] =
y;
31405 this.
data.array[ index * this.
data.stride + this.offset + 2 ] =
z;
31415 this.
data.array[ index * this.
data.stride + this.offset + 3 ] =
w;
31433 let y = this.
data.array[ index * this.
data.stride + this.offset + 1 ];
31443 let z = this.
data.array[ index * this.
data.stride + this.offset + 2 ];
31453 let w = this.
data.array[ index * this.
data.stride + this.offset + 3 ];
31472 this.
data.array[ index + 0 ] =
x;
31473 this.
data.array[ index + 1 ] =
y;
31491 this.
data.array[ index + 0 ] =
x;
31492 this.
data.array[ index + 1 ] =
y;
31493 this.
data.array[ index + 2 ] =
z;
31512 this.
data.array[ index + 0 ] =
x;
31513 this.
data.array[ index + 1 ] =
y;
31514 this.
data.array[ index + 2 ] =
z;
31515 this.
data.array[ index + 3 ] =
w;
31525 console.log(
'THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.' );
31547 data.interleavedBuffers = {};
31551 if (
data.interleavedBuffers[
this.data.uuid ] ===
undefined ) {
31567 console.log(
'THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.' );
31571 for (
let i = 0;
i < this.
count; i ++ ) {
31587 type: this.
array.constructor.name,
31598 data.interleavedBuffers = {};
31602 if (
data.interleavedBuffers[
this.data.uuid ] ===
undefined ) {
31630 this.type =
'SpriteMaterial';
31654 this.color.copy(
source.color );
31696 this.isSprite =
true;
31698 this.type =
'Sprite';
31705 - 0.5, - 0.5, 0, 0, 0,
31706 0.5, - 0.5, 0, 1, 0,
31708 - 0.5, 0.5, 0, 0, 1
31713 _geometry.setIndex( [ 0, 1, 2, 0, 2, 3 ] );
31730 console.error(
'THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.' );
31734 _worldScale.setFromMatrixScale( this.matrixWorld );
31737 this.modelViewMatrix.multiplyMatrices(
raycaster.camera.matrixWorldInverse,
this.matrixWorld );
31739 _mvPosition.setFromMatrixPosition( this.modelViewMatrix );
31741 if (
raycaster.camera.isPerspectiveCamera &&
this.material.sizeAttenuation ===
false ) {
31747 const rotation = this.material.rotation;
31807 this.material =
source.material;
31855 Object.defineProperties(
this, {
31873 const levels =
source.levels;
31893 const levels = this.
levels;
31897 for ( l = 0;
l <
levels.length;
l ++ ) {
31909 this.
add(
object );
31925 const levels = this.
levels;
31927 if ( levels.length > 0 ) {
31949 return levels[
i - 1 ].object;
31961 if ( levels.length > 0 ) {
31963 _v1$2.setFromMatrixPosition( this.matrixWorld );
31977 if ( levels.length > 1 ) {
31979 _v1$2.setFromMatrixPosition(
camera.matrixWorld );
31980 _v2$1.setFromMatrixPosition( this.matrixWorld );
31984 levels[ 0 ].object.visible =
true;
32000 levels[
i - 1 ].object.visible =
false;
32001 levels[
i ].object.visible =
true;
32013 for ( ;
i <
l;
i ++ ) {
32015 levels[
i ].object.visible =
false;
32027 if ( this.
autoUpdate ===
false )
data.object.autoUpdate =
false;
32029 data.object.levels = [];
32031 const levels = this.
levels;
32037 data.object.levels.push( {
32070 this.isSkinnedMesh =
true;
32072 this.type =
'SkinnedMesh';
32079 this.boundingSphere =
null;
32110 if ( this.boundingSphere ===
null ) {
32112 this.boundingSphere =
new Sphere();
32116 this.boundingSphere.makeEmpty();
32123 this.boundingSphere.expandByPoint(
_vertex );
32140 if (
source.boundingSphere !==
null ) this.boundingSphere =
source.boundingSphere.clone();
32171 if (
_ray$2.intersectsBox(
this.boundingBox ) ===
false )
return;
32199 this.
skeleton.calculateInverses();
32220 const skinWeight = this.geometry.attributes.skinWeight;
32234 vector.set( 1, 0, 0, 0 );
32258 console.warn(
'THREE.SkinnedMesh: Unrecognized bindMode: ' + this.
bindMode );
32269 _skinIndex.fromBufferAttribute( geometry.attributes.skinIndex,
index );
32276 for (
let i = 0;
i < 4;
i ++ ) {
32298 console.warn(
'THREE.SkinnedMesh: .boneTransform() was renamed to .applyBoneTransform() in r151.' );
32314 this.type =
'Bone';
32322 constructor(
data =
null,
width = 1,
height = 1, format, type,
mapping,
wrapS,
wrapT,
magFilter =
NearestFilter,
minFilter =
NearestFilter,
anisotropy,
colorSpace ) {
32326 this.isDataTexture =
true;
32331 this.
flipY =
false;
32376 console.warn(
'THREE.Skeleton: Number of inverse bone matrices does not match amount of bones.' );
32400 if ( this.
bones[ i ] ) {
32436 if (
bone.parent &&
bone.parent.isBone ) {
32438 bone.matrix.copy(
bone.parent.matrixWorld ).invert();
32439 bone.matrix.multiply(
bone.matrixWorld );
32443 bone.matrix.copy(
bone.matrixWorld );
32549 for (
let i = 0,
l =
json.bones.length;
i <
l;
i ++ ) {
32556 console.warn(
'THREE.Skeleton: No bone found with UUID:',
uuid );
32561 this.
bones.push( bone );
32633 data.isInstancedBufferAttribute =
true;
32657 this.isInstancedMesh =
true;
32662 this.count =
count;
32665 this.boundingSphere =
null;
32678 const count = this.
count;
32686 if ( geometry.boundingBox ===
null ) {
32709 const count = this.
count;
32711 if ( this.boundingSphere ===
null ) {
32713 this.boundingSphere =
new Sphere();
32717 if (
geometry.boundingSphere ===
null ) {
32723 this.boundingSphere.makeEmpty();
32731 this.boundingSphere.union(
_sphere$3 );
32741 this.instanceMatrix.copy(
source.instanceMatrix );
32745 this.count =
source.count;
32748 if (
source.boundingSphere !==
null ) this.boundingSphere =
source.boundingSphere.clone();
32762 matrix.fromArray( this.instanceMatrix.array,
index * 16 );
32832 matrix.toArray( this.instanceMatrix.array,
index * 16 );
32873 const list = this.
list;
32874 if ( this.index >=
pool.length ) {
32898 this.list.length = 0;
32929 if (
src.isInterleavedBufferAttribute ||
src.array.constructor !==
target.array.constructor ) {
32951 target.needsUpdate =
true;
32967 this.isBatchedMesh =
true;
32971 this.boundingSphere =
null;
33075 throw new Error(
'BatchedMesh: All geometries must consistently have "index".' );
33097 throw new Error(
'BatchedMesh: All attributes must have a consistent itemSize and normalized value.' );
33127 if (
active[
i ] ===
false )
continue;
33139 if ( this.boundingSphere ===
null ) {
33141 this.boundingSphere =
new Sphere();
33149 boundingSphere.makeEmpty();
33152 if (
active[
i ] ===
false )
continue;
33171 throw new Error(
'BatchedMesh: Maximum geometry count reached.' );
33245 throw new Error(
'BatchedMesh: Reserved space request exceeds the maximum buffer size.' );
33301 throw new Error(
'BatchedMesh: Maximum geometry count reached.' );
33310 const srcIndex = geometry.getIndex();
33315 geometry.attributes.position.count >
reservedRange.vertexCount
33318 throw new Error(
'BatchedMesh: Reserved space not large enough for provided geometry.' );
33380 if ( geometry.boundingBox !==
null ) {
33383 bound.boxInitialized =
true;
33387 bound.boxInitialized =
false;
33391 if (
geometry.boundingSphere !==
null ) {
33394 bound.sphereInitialized =
true;
33398 bound.sphereInitialized =
false;
33404 const posAttr = geometry.getAttribute(
'position' );
33434 if (
active[
id ] ===
false ) {
33444 if (
bound.boxInitialized ===
false ) {
33464 bound.boxInitialized =
true;
33477 if (
active[
id ] ===
false ) {
33487 if (
bound.sphereInitialized ===
false ) {
33498 let maxRadiusSq = 0;
33514 bound.sphereInitialized =
true;
33615 if (
_mesh.geometry.boundingBox ===
null ) {
33617 _mesh.geometry.boundingBox =
new Box3();
33621 if (
_mesh.geometry.boundingSphere ===
null ) {
33658 _mesh.material =
null;
33659 _mesh.geometry.index =
null;
33660 _mesh.geometry.attributes = {};
33669 this.geometry =
source.geometry.clone();
33673 this.boundingSphere =
source.boundingSphere !==
null ?
source.boundingSphere.clone() :
null;
33707 this.geometry.dispose();
33727 const index =
geometry.getIndex();
33740 .multiplyMatrices( camera.projectionMatrix,
camera.matrixWorldInverse )
33741 .multiply( this.matrixWorld );
33861 this.type =
'LineBasicMaterial';
33882 this.color.copy(
source.color );
33910 this.isLine =
true;
33912 this.type =
'Line';
33926 this.geometry =
source.geometry;
33938 if ( geometry.index ===
null ) {
33957 console.warn(
'THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.' );
33994 const step = this.isLineSegments ? 2 : 1;
34000 if (
index !==
null ) {
34008 const b =
index.getX(
i + 1 );
34017 interRay.applyMatrix4( this.matrixWorld );
34052 interRay.applyMatrix4( this.matrixWorld );
34081 const morphAttributes =
geometry.morphAttributes;
34084 if (
keys.length > 0 ) {
34119 this.isLineSegments =
true;
34121 this.type =
'LineSegments';
34131 if ( geometry.index ===
null ) {
34150 console.warn(
'THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.' );
34166 this.isLineLoop =
true;
34168 this.type =
'LineLoop';
34182 this.type =
'PointsMaterial';
34203 this.color.copy(
source.color );
34209 this.size =
source.size;
34231 this.isPoints =
true;
34233 this.type =
'Points';
34247 this.geometry =
source.geometry;
34282 if (
index !==
null ) {
34318 const morphAttributes =
geometry.morphAttributes;
34321 if (
keys.length > 0 ) {
34390 const scope =
this;
34394 scope.needsUpdate =
true;
34399 if (
'requestVideoFrameCallback' in
video ) {
34409 return new this.
constructor( this.image ).copy(
this );
34420 this.needsUpdate =
true;
34441 this.needsUpdate =
true;
34449 constructor(
mipmaps,
width,
height, format, type,
mapping,
wrapS,
wrapT,
magFilter,
minFilter,
anisotropy,
colorSpace ) {
34461 this.
flipY =
false;
34479 this.image.depth =
depth;
34509 this.needsUpdate =
true;
34549 this.type =
'Curve';
34560 console.warn(
'THREE.Curve: .getPoint() not implemented.' );
34622 !
this.needsUpdate ) {
34628 this.needsUpdate =
false;
34653 this.needsUpdate =
true;
34712 return i / (
il - 1 );
34742 const delta = 0.0001;
34748 if (
t1 < 0 )
t1 = 0;
34749 if (
t2 > 1 )
t2 = 1;
34854 if (
closed ===
true ) {
34908 data.type = this.type;
34932 this.type =
'EllipseCurve';
34977 if ( deltaAngle ===
twoPi ) {
34998 const tx = x - this.
aX;
34999 const ty = y - this.
aY;
35007 return point.set( x,
y );
35021 this.aStartAngle =
source.aStartAngle;
35063 this.aStartAngle =
json.aStartAngle;
35084 this.type =
'ArcCurve';
35153 calc:
function (
t ) {
35180 this.type =
'CatmullRomCurve3';
35194 const l =
points.length;
35196 const p = (
l - ( this.
closed ? 0 : 1 ) ) *
t;
35213 if ( this.
closed || intPoint > 0 ) {
35228 if ( this.
closed || intPoint + 2 <
l ) {
35243 const pow = this.
curveType ===
'chordal' ? 0.5 : 0.25;
35257 }
else if ( this.
curveType ===
'catmullrom' ) {
35259 px.initCatmullRom( p0.x,
p1.x,
p2.x,
p3.x,
this.tension );
35260 py.initCatmullRom(
p0.y,
p1.y,
p2.y,
p3.y,
this.tension );
35261 pz.initCatmullRom(
p0.z,
p1.z,
p2.z,
p3.z,
this.tension );
35303 for (
let i = 0,
l = this.
points.length; i <
l;
i ++ ) {
35324 for (
let i = 0,
l =
json.points.length;
i <
l;
i ++ ) {
35348 const v0 = (
p2 -
p0 ) * 0.5;
35349 const v1 = (
p3 -
p1 ) * 0.5;
35367 return 2 * ( 1 -
t ) *
t *
p;
35389 return k *
k *
k *
p;
35396 return 3 *
k *
k *
t *
p;
35402 return 3 * ( 1 -
t ) *
t *
t *
p;
35408 return t *
t *
t *
p;
35427 this.type =
'CubicBezierCurve';
35456 this.v1.copy(
source.v1 );
35457 this.v2.copy(
source.v2 );
35458 this.v3.copy(
source.v3 );
35468 data.v0 = this.
v0.toArray();
35469 data.v1 = this.v1.toArray();
35470 data.v2 = this.v2.toArray();
35471 data.v3 = this.v3.toArray();
35481 this.
v0.fromArray(
json.v0 );
35482 this.v1.fromArray(
json.v1 );
35483 this.v2.fromArray(
json.v2 );
35484 this.v3.fromArray(
json.v3 );
35500 this.type =
'CubicBezierCurve3';
35513 const v0 = this.
v0, v1 = this.
v1, v2 = this.
v2, v3 = this.
v3;
35530 this.v1.copy(
source.v1 );
35531 this.v2.copy(
source.v2 );
35532 this.v3.copy(
source.v3 );
35542 data.v0 = this.
v0.toArray();
35543 data.v1 = this.v1.toArray();
35544 data.v2 = this.v2.toArray();
35545 data.v3 = this.v3.toArray();
35555 this.
v0.fromArray(
json.v0 );
35556 this.v1.fromArray(
json.v1 );
35557 this.v2.fromArray(
json.v2 );
35558 this.v3.fromArray(
json.v3 );
35574 this.type =
'LineCurve';
35587 point.copy( this.v2 );
35591 point.copy( this.v2 ).sub( this.v1 );
35592 point.multiplyScalar(
t ).add( this.v1 );
35609 return optionalTarget.subVectors( this.v2, this.v1 ).normalize();
35623 this.v1.copy(
source.v1 );
35624 this.v2.copy(
source.v2 );
35634 data.v1 = this.v1.toArray();
35635 data.v2 = this.v2.toArray();
35645 this.v1.fromArray(
json.v1 );
35646 this.v2.fromArray(
json.v2 );
35662 this.type =
'LineCurve3';
35675 point.copy( this.v2 );
35679 point.copy( this.v2 ).sub( this.v1 );
35680 point.multiplyScalar(
t ).add( this.v1 );
35697 return optionalTarget.subVectors( this.v2, this.v1 ).normalize();
35711 this.v1.copy(
source.v1 );
35712 this.v2.copy(
source.v2 );
35722 data.v1 = this.v1.toArray();
35723 data.v2 = this.v2.toArray();
35733 this.v1.fromArray(
json.v1 );
35734 this.v2.fromArray(
json.v2 );
35750 this.type =
'QuadraticBezierCurve';
35762 const v0 = this.
v0, v1 = this.
v1, v2 = this.
v2;
35778 this.v1.copy(
source.v1 );
35779 this.v2.copy(
source.v2 );
35789 data.v0 = this.
v0.toArray();
35790 data.v1 = this.v1.toArray();
35791 data.v2 = this.v2.toArray();
35801 this.
v0.fromArray(
json.v0 );
35802 this.v1.fromArray(
json.v1 );
35803 this.v2.fromArray(
json.v2 );
35819 this.type =
'QuadraticBezierCurve3';
35831 const v0 = this.
v0, v1 = this.
v1, v2 = this.
v2;
35848 this.v1.copy(
source.v1 );
35849 this.v2.copy(
source.v2 );
35859 data.v0 = this.
v0.toArray();
35860 data.v1 = this.v1.toArray();
35861 data.v2 = this.v2.toArray();
35871 this.
v0.fromArray(
json.v0 );
35872 this.v1.fromArray(
json.v1 );
35873 this.v2.fromArray(
json.v2 );
35889 this.type =
'SplineCurve';
35900 const p = (
points.length - 1 ) * t;
35943 for (
let i = 0,
l = this.
points.length; i <
l;
i ++ ) {
35960 for (
let i = 0,
l =
json.points.length;
i <
l;
i ++ ) {
35998 this.type =
'CurvePath';
36083 this.needsUpdate =
true;
36108 for (
let i = 0,
l = this.
curves.length; i <
l;
i ++ ) {
36150 : (
curve.isLineCurve ||
curve.isLineCurve3 ) ? 1
36156 for (
let j = 0;
j <
pts.length;
j ++ ) {
36206 for (
let i = 0,
l = this.
curves.length; i <
l;
i ++ ) {
36224 for (
let i = 0,
l =
json.curves.length;
i <
l;
i ++ ) {
36243 this.type =
'Path';
36369 if ( this.
curves.length > 0 ) {
36374 if ( !
firstPoint.equals(
this.currentPoint ) ) {
36429 this.type =
'LatheGeometry';
36431 this.parameters = {
36486 case (
points.length - 1 ):
36566 const d =
base + 1;
36590 this.parameters =
Object.assign( {},
source.parameters );
36614 this.type =
'CapsuleGeometry';
36616 this.parameters = {
36639 this.type =
'CircleGeometry';
36641 this.parameters = {
36666 uvs.push( 0.5, 0.5 );
36713 this.parameters =
Object.assign( {},
source.parameters );
36733 this.type =
'CylinderGeometry';
36735 this.parameters = {
36746 const scope =
this;
36788 let groupCount = 0;
36828 uvs.push(
u, 1 -
v );
36907 uvs.push( 0.5, 0.5 );
36958 if (
top ===
true ) {
36992 this.parameters =
Object.assign( {},
source.parameters );
37012 this.type =
'ConeGeometry';
37014 this.parameters = {
37040 this.type =
'PolyhedronGeometry';
37042 this.parameters = {
37122 const aj =
a.clone().lerp(
c,
i /
cols );
37123 const bj =
b.clone().lerp(
c,
i /
cols );
37129 if (
j === 0 &&
i ===
cols ) {
37147 for (
let j = 0;
j < 2 * (
cols -
i ) - 1;
j ++ ) {
37149 const k =
Math.floor(
j / 2 );
37151 if (
j % 2 === 0 ) {
37232 if (
max > 0.9 &&
min < 0.1 ) {
37282 centroid.copy(
a ).add(
b ).add(
c ).divideScalar( 3 );
37296 if ( (
azimuth < 0 ) && (
uv.x === 1 ) ) {
37333 this.parameters =
Object.assign( {},
source.parameters );
37351 const t = ( 1 +
Math.sqrt( 5 ) ) / 2;
37357 - 1, - 1, - 1, - 1, - 1, 1,
37358 - 1, 1, - 1, - 1, 1, 1,
37359 1, - 1, - 1, 1, - 1, 1,
37360 1, 1, - 1, 1, 1, 1,
37363 0, -
r, -
t, 0, -
r,
t,
37364 0,
r, -
t, 0,
r,
t,
37367 -
r, -
t, 0, -
r,
t, 0,
37368 r, -
t, 0,
r,
t, 0,
37371 -
t, 0, -
r,
t, 0, -
r,
37376 3, 11, 7, 3, 7, 15, 3, 15, 13,
37377 7, 19, 17, 7, 17, 6, 7, 6, 15,
37378 17, 4, 8, 17, 8, 10, 17, 10, 6,
37379 8, 0, 16, 8, 16, 2, 8, 2, 10,
37380 0, 12, 1, 0, 1, 18, 0, 18, 16,
37381 6, 10, 2, 6, 2, 13, 6, 13, 15,
37382 2, 16, 18, 2, 18, 3, 2, 3, 13,
37383 18, 1, 9, 18, 9, 11, 18, 11, 3,
37384 4, 14, 12, 4, 12, 0, 4, 0, 8,
37385 11, 9, 5, 11, 5, 19, 11, 19, 7,
37386 19, 5, 14, 19, 14, 4, 19, 4, 17,
37387 1, 12, 14, 1, 14, 5, 1, 5, 9
37392 this.type =
'DodecahedronGeometry';
37394 this.parameters = {
37420 this.type =
'EdgesGeometry';
37422 this.parameters = {
37438 const vertKeys = [
'a',
'b',
'c' ];
37478 for (
let j = 0;
j < 3;
j ++ ) {
37481 const jNext = (
j + 1 ) % 3;
37546 this.parameters =
Object.assign( {},
source.parameters );
37562 this.type =
'Shape';
37572 for (
let i = 0,
l = this.
holes.length; i <
l;
i ++ ) {
37620 for (
let i = 0,
l = this.
holes.length; i <
l;
i ++ ) {
37638 for (
let i = 0,
l =
json.holes.length;
i <
l;
i ++ ) {
37671 if (
data.length > 80 *
dim ) {
37730 if ( ! start )
return start;
37731 if ( !
end )
end = start;
37739 if ( !
p.steiner && (
equals(
p,
p.next ) ||
area(
p.prev,
p,
p.next ) === 0 ) ) {
37743 if (
p ===
p.next )
break;
37761 if ( !
ear )
return;
37770 while (
ear.prev !==
ear.next ) {
37804 }
else if (
pass === 1 ) {
37811 }
else if (
pass === 2 ) {
37828 const a =
ear.prev,
37832 if (
area(
a,
b,
c ) >= 0 )
return false;
37844 while (
p !==
a ) {
37846 if (
p.x >=
x0 &&
p.x <=
x1 &&
p.y >=
y0 &&
p.y <=
y1 &&
37848 area(
p.prev,
p,
p.next ) >= 0 )
return false;
37859 const a =
ear.prev,
37863 if (
area(
a,
b,
c ) >= 0 )
return false;
37883 if (
p.x >=
x0 &&
p.x <=
x1 &&
p.y >=
y0 &&
p.y <=
y1 &&
p !==
a &&
p !==
c &&
37887 if (
n.x >=
x0 &&
n.x <=
x1 &&
n.y >=
y0 &&
n.y <=
y1 &&
n !==
a &&
n !==
c &&
37894 while (
p &&
p.z >=
minZ ) {
37896 if (
p.x >=
x0 &&
p.x <=
x1 &&
p.y >=
y0 &&
p.y <=
y1 &&
p !==
a &&
p !==
c &&
37903 while (
n &&
n.z <=
maxZ ) {
37905 if (
n.x >=
x0 &&
n.x <=
x1 &&
n.y >=
y0 &&
n.y <=
y1 &&
n !==
a &&
n !==
c &&
37940 }
while (
p !== start );
37953 let b =
a.next.next;
37954 while (
b !==
a.prev ) {
37978 }
while (
a !== start );
38001 for (
i = 0;
i <
queue.length;
i ++ ) {
38050 const x =
p.x + (
hy -
p.y ) * (
p.next.x -
p.x ) / (
p.next.y -
p.y );
38054 m =
p.x <
p.next.x ?
p :
p.next;
38055 if (
x ===
hx )
return m;
38065 if ( !
m )
return null;
38080 if (
hx >=
p.x &&
p.x >=
mx &&
hx !==
p.x &&
38096 }
while (
p !==
stop );
38105 return area(
m.prev,
m,
p.prev ) < 0 &&
area(
p.next,
m,
m.next ) < 0;
38120 }
while (
p !== start );
38122 p.prevZ.nextZ =
null;
38160 if (
pSize !== 0 && (
qSize === 0 || !
q ||
p.z <=
q.z ) ) {
38202 x = (
x | (
x << 8 ) ) & 0x00FF00FF;
38203 x = (
x | (
x << 4 ) ) & 0x0F0F0F0F;
38204 x = (
x | (
x << 2 ) ) & 0x33333333;
38205 x = (
x | (
x << 1 ) ) & 0x55555555;
38207 y = (
y | (
y << 8 ) ) & 0x00FF00FF;
38208 y = (
y | (
y << 4 ) ) & 0x0F0F0F0F;
38209 y = (
y | (
y << 2 ) ) & 0x33333333;
38210 y = (
y | (
y << 1 ) ) & 0x55555555;
38212 return x | (
y << 1 );
38226 }
while (
p !== start );
38254 return (
q.y -
p.y ) * (
r.x -
q.x ) - (
q.x -
p.x ) * (
r.y -
q.y );
38261 return p1.x ===
p2.x &&
p1.y ===
p2.y;
38273 if (
o1 !==
o2 &&
o3 !==
o4 )
return true;
38293 return num > 0 ? 1 :
num < 0 ? - 1 : 0;
38303 if (
p.i !==
a.i &&
p.next.i !==
a.i &&
p.i !==
b.i &&
p.next.i !==
b.i &&
38307 }
while (
p !==
a );
38316 return area(
a.prev,
a,
a.next ) < 0 ?
38327 const px = (
a.x +
b.x ) / 2,
38328 py = (
a.y +
b.y ) / 2;
38331 if ( ( (
p.y >
py ) !== (
p.next.y >
py ) ) &&
p.next.y !==
p.y &&
38332 (
px < (
p.next.x -
p.x ) * (
py -
p.y ) / (
p.next.y -
p.y ) +
p.x ) )
38336 }
while (
p !==
a );
38379 p.next =
last.next;
38381 last.next.prev =
p;
38392 p.next.prev =
p.prev;
38393 p.prev.next =
p.next;
38395 if (
p.prevZ )
p.prevZ.nextZ =
p.nextZ;
38396 if (
p.nextZ )
p.nextZ.prevZ =
p.prevZ;
38448 for (
let p =
n - 1,
q = 0;
q <
n;
p =
q ++ ) {
38557 this.type =
'ExtrudeGeometry';
38559 this.parameters = {
38566 const scope =
this;
38691 if ( !
vec )
console.error(
'THREE.ExtrudeGeometry: vec does not exist' );
38693 return pt.clone().addScaledVector(
vec,
size );
38831 if (
j ===
il )
j = 0;
38832 if (
k ===
il )
k = 0;
38852 if (
j ===
il )
j = 0;
38853 if (
k ===
il )
k = 0;
39034 const face = faces[
i ];
39046 const face = faces[
i ];
39057 const face = faces[
i ];
39066 const face = faces[
i ];
39106 while ( --
i >= 0 ) {
39132 function v(
x,
y,
z ) {
39141 function f3(
a,
b,
c ) {
39156 function f4(
a,
b,
c,
d ) {
39204 this.parameters =
Object.assign( {},
source.parameters );
39214 const shapes = this.parameters.shapes;
39215 const options = this.parameters.options;
39337 const t = ( 1 +
Math.sqrt( 5 ) ) / 2;
39340 - 1,
t, 0, 1,
t, 0, - 1, -
t, 0, 1, -
t, 0,
39341 0, - 1,
t, 0, 1,
t, 0, - 1, -
t, 0, 1, -
t,
39342 t, 0, - 1,
t, 0, 1, -
t, 0, - 1, -
t, 0, 1
39346 0, 11, 5, 0, 5, 1, 0, 1, 7, 0, 7, 10, 0, 10, 11,
39347 1, 5, 9, 5, 11, 4, 11, 10, 2, 10, 7, 6, 7, 1, 8,
39348 3, 9, 4, 3, 4, 2, 3, 2, 6, 3, 6, 8, 3, 8, 9,
39349 4, 9, 5, 2, 4, 11, 6, 2, 10, 8, 6, 7, 9, 8, 1
39354 this.type =
'IcosahedronGeometry';
39356 this.parameters = {
39376 1, 0, 0, - 1, 0, 0, 0, 1, 0,
39377 0, - 1, 0, 0, 0, 1, 0, 0, - 1
39381 0, 2, 4, 0, 4, 3, 0, 3, 5,
39382 0, 5, 2, 1, 2, 5, 1, 5, 3,
39388 this.type =
'OctahedronGeometry';
39390 this.parameters = {
39411 this.type =
'RingGeometry';
39413 this.parameters = {
39512 this.parameters =
Object.assign( {},
source.parameters );
39532 this.type =
'ShapeGeometry';
39534 this.parameters = {
39635 for (
let i = 0,
l = faces.length;
i <
l;
i ++ ) {
39637 const face = faces[
i ];
39656 this.parameters =
Object.assign( {},
source.parameters );
39666 const shapes = this.parameters.shapes;
39720 this.type =
'SphereGeometry';
39722 this.parameters = {
39832 this.parameters =
Object.assign( {},
source.parameters );
39851 1, 1, 1, - 1, - 1, 1, - 1, 1, - 1, 1, - 1, - 1
39855 2, 1, 0, 0, 3, 2, 1, 3, 0, 2, 3, 1
39860 this.type =
'TetrahedronGeometry';
39862 this.parameters = {
39883 this.type =
'TorusGeometry';
39885 this.parameters = {
39978 this.parameters =
Object.assign( {},
source.parameters );
39998 this.type =
'TorusKnotGeometry';
40000 this.parameters = {
40047 T.subVectors(
P2,
P1 );
40048 N.addVectors(
P2,
P1 );
40049 B.crossVectors(
T,
N );
40050 N.crossVectors(
B,
T );
40140 this.parameters =
Object.assign( {},
source.parameters );
40156 constructor(
path =
new QuadraticBezierCurve3(
new Vector3( - 1, - 1, 0 ),
new Vector3( - 1, 1, 0 ),
new Vector3( 1, 1, 0 ) ),
tubularSegments = 64,
radius = 1,
radialSegments = 8,
closed =
false ) {
40160 this.type =
'TubeGeometry';
40162 this.parameters = {
40181 const normal =
new Vector3();
40317 this.parameters =
Object.assign( {},
source.parameters );
40327 data.path = this.parameters.path.toJSON();
40339 data.tubularSegments,
40341 data.radialSegments,
40355 this.type =
'WireframeGeometry';
40357 this.parameters = {
40381 if (
groups.length === 0 ) {
40398 for (
let j = 0;
j < 3;
j ++ ) {
40408 vertices.push( start.x, start.y, start.z );
40427 for (
let j = 0;
j < 3;
j ++ ) {
40433 const index2 = 3 *
i + ( (
j + 1 ) % 3 );
40440 vertices.push( start.x, start.y, start.z );
40463 this.parameters =
Object.assign( {},
source.parameters );
40523 this.type =
'ShadowMaterial';
40538 this.color.copy(
source.color );
40556 this.type =
'RawShaderMaterial';
40570 this.defines = {
'STANDARD':
'' };
40572 this.type =
'MeshStandardMaterial';
40607 this.envMap =
null;
40627 this.defines = {
'STANDARD':
'' };
40629 this.color.copy(
source.color );
40662 this.envMap =
source.envMap;
40695 this.type =
'MeshPhysicalMaterial';
40708 Object.defineProperty(
this,
'reflectivity', {
40711 return (
clamp( 2.5 * ( this.
ior - 1 ) / ( this.
ior + 1 ), 0, 1 ) );
40813 set sheen( value ) {
40815 if ( this.
_sheen > 0 !== value > 0 ) {
40906 this.type =
'MeshPhongMaterial';
40939 this.envMap =
null;
40961 this.color.copy(
source.color );
40992 this.envMap =
source.envMap;
41020 this.defines = {
'TOON':
'' };
41022 this.type =
'MeshToonMaterial';
41067 this.color.copy(
source.color );
41116 this.type =
'MeshNormalMaterial';
41172 this.type =
'MeshLambertMaterial';
41203 this.envMap =
null;
41225 this.color.copy(
source.color );
41254 this.envMap =
source.envMap;
41282 this.defines = {
'MATCAP':
'' };
41284 this.type =
'MeshMatcapMaterial';
41318 this.defines = {
'MATCAP':
'' };
41320 this.color.copy(
source.color );
41357 this.type =
'LineDashedMaterial';
41371 this.scale =
source.scale;
41387 if (
typeof type.BYTES_PER_ELEMENT ===
'number' ) {
41389 return new type(
array );
41528 for (
let i = 0;
i <
clip.tracks.length; ++
i ) {
41536 for (
let j = 0;
j <
track.times.length; ++
j ) {
41552 if (
times.length === 0 )
continue;
41567 for (
let i = 0;
i <
clip.tracks.length; ++
i ) {
41579 for (
let i = 0;
i <
clip.tracks.length; ++
i ) {
41585 clip.resetDuration();
41593 if (
fps <= 0 )
fps = 30;
41620 if (
referenceTrack.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline ) {
41629 if (
targetTrack.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline ) {
41819 if ( ! (
t >=
t0 ) ) {
41951 throw new Error(
'call to abstract method' );
42062 stride = this.valueSize;
42081 p = (
t -
t0 ) / (
t1 -
t0 ),
42088 const s0 = ( 1 +
wP ) *
ppp + ( - 1.5 - 2 *
wP ) *
pp + ( - 0.5 +
wP ) *
p + 1;
42089 const s1 = ( - 1 -
wN ) *
ppp + ( 1.5 +
wN ) *
pp + 0.5 *
p;
42170 if (
name ===
undefined )
throw new Error(
'THREE.KeyframeTrack: track name is undefined' );
42192 if (
trackType.toJSON !==
this.toJSON ) {
42201 'name':
track.name,
42269 const message =
'unsupported interpolation for ' +
42320 return this.values.length / this.
times.length;
42414 console.error(
'THREE.KeyframeTrack: Invalid value size in track.',
this );
42422 nKeys =
times.length;
42424 if (
nKeys === 0 ) {
42426 console.error(
'THREE.KeyframeTrack: Track is empty.',
this );
42439 console.error(
'THREE.KeyframeTrack: Time is not a valid number.',
this,
i,
currTime );
42467 console.error(
'THREE.KeyframeTrack: Value is not a valid number.',
this,
i,
value );
42489 values = this.values.slice(),
42599 const values = this.values.slice();
42733 static parse( json ) {
42760 'duration':
clip.duration,
42763 'blendMode':
clip.blendMode
42826 clipArray =
o.geometry &&
o.geometry.animations ||
o.animations;
42894 console.error(
'THREE.AnimationClip: No animation in JSONLoader data.' );
42910 if (
times.length !== 0 ) {
43005 if (
tracks.length === 0 ) {
43038 for (
let i = 0;
i < this.
tracks.length; i ++ ) {
43040 this.
tracks[
i ].trim( 0, this.duration );
43052 for (
let i = 0;
i < this.
tracks.length; i ++ ) {
43064 for (
let i = 0;
i < this.
tracks.length; i ++ ) {
43078 for (
let i = 0;
i < this.
tracks.length; i ++ ) {
43098 switch (
typeName.toLowerCase() ) {
43134 throw new Error(
'THREE.KeyframeTrack: Unsupported typeName: ' +
typeName );
43142 throw new Error(
'THREE.KeyframeTrack: track type undefined, can not parse' );
43181 if ( this.
enabled ===
false )
return;
43189 get:
function (
key ) {
43191 if ( this.
enabled ===
false )
return;
43199 remove:
function (
key ) {
43205 clear:
function () {
43217 const scope =
this;
43279 scope.onError( url );
43287 if ( urlModifier ) {
43317 if (
index !== - 1 ) {
43372 const scope =
this;
43421 Loader.DEFAULT_MATERIAL_NAME =
'__DEFAULT';
43450 url = this.
manager.resolveURL( url );
43456 this.
manager.itemStart( url );
43515 if ( response.status === 0 ) {
43517 console.warn(
'THREE.FileLoader: HTTP Status 0 received.' );
43591 case 'arraybuffer':
43623 const exec = re.exec( mimeType );
43624 const label = exec && exec[ 1 ] ? exec[ 1 ].toLowerCase() : undefined;
43625 const decoder = new TextDecoder( label );
43626 return response.arrayBuffer().then( ab => decoder.decode( ab ) );
43635 // Add to cache only on HTTP success, so that we do not cache
43636 // error response bodies as proper responses to requests.
43637 Cache.add( url, data );
43639 const callbacks = loading[ url ];
43640 delete loading[ url ];
43642 for ( let i = 0, il = callbacks.length; i < il; i ++ ) {
43644 const callback = callbacks[ i ];
43645 if ( callback.onLoad ) callback.onLoad( data );
43652 // Abort errors and other errors are handled the same
43654 const callbacks = loading[ url ];
43656 if ( callbacks === undefined ) {
43658 // When onLoad was called and url was deleted in `loading`
43659 this.manager.itemError( url );
43664 delete loading[ url ];
43666 for ( let i = 0, il = callbacks.length; i < il; i ++ ) {
43668 const callback = callbacks[ i ];
43669 if ( callback.onError ) callback.onError( err );
43673 this.manager.itemError( url );
43678 this.manager.itemEnd( url );
43682 this.manager.itemStart( url );
43686 setResponseType( value ) {
43688 this.responseType = value;
43693 setMimeType( value ) {
43695 this.mimeType = value;
43702 class AnimationLoader extends Loader {
43704 constructor( manager ) {
43710 load( url, onLoad, onProgress, onError ) {
43712 const scope = this;
43714 const loader = new FileLoader( this.manager );
43715 loader.setPath( this.path );
43716 loader.setRequestHeader( this.requestHeader );
43717 loader.setWithCredentials( this.withCredentials );
43718 loader.load( url, function ( text ) {
43722 onLoad( scope.parse( JSON.parse( text ) ) );
43732 console.error( e );
43736 scope.manager.itemError( url );
43740 }, onProgress, onError );
43746 const animations = [];
43748 for ( let i = 0; i < json.length; i ++ ) {
43750 const clip = AnimationClip.parse( json[ i ] );
43752 animations.push( clip );
43768 class CompressedTextureLoader extends Loader {
43770 constructor( manager ) {
43776 load( url, onLoad, onProgress, onError ) {
43778 const scope = this;
43782 const texture = new CompressedTexture();
43784 const loader = new FileLoader( this.manager );
43785 loader.setPath( this.path );
43786 loader.setResponseType( 'arraybuffer' );
43787 loader.setRequestHeader( this.requestHeader );
43788 loader.setWithCredentials( scope.withCredentials );
43792 function loadTexture( i ) {
43794 loader.load( url[ i ], function ( buffer ) {
43796 const texDatas = scope.parse( buffer, true );
43799 width: texDatas.width,
43800 height: texDatas.height,
43801 format: texDatas.format,
43802 mipmaps: texDatas.mipmaps
43807 if ( loaded === 6 ) {
43809 if ( texDatas.mipmapCount === 1 ) texture.minFilter = LinearFilter;
43811 texture.image = images;
43812 texture.format = texDatas.format;
43813 texture.needsUpdate = true;
43815 if ( onLoad ) onLoad( texture );
43819 }, onProgress, onError );
43823 if ( Array.isArray( url ) ) {
43825 for ( let i = 0, il = url.length; i < il; ++ i ) {
43833 // compressed cubemap texture stored in a single DDS file
43835 loader.load( url, function ( buffer ) {
43837 const texDatas = scope.parse( buffer, true );
43839 if ( texDatas.isCubemap ) {
43841 const faces = texDatas.mipmaps.length / texDatas.mipmapCount;
43843 for ( let f = 0; f < faces; f ++ ) {
43845 images[ f ] = { mipmaps: [] };
43847 for ( let i = 0; i < texDatas.mipmapCount; i ++ ) {
43849 images[ f ].mipmaps.push( texDatas.mipmaps[ f * texDatas.mipmapCount + i ] );
43850 images[ f ].format = texDatas.format;
43851 images[ f ].width = texDatas.width;
43852 images[ f ].height = texDatas.height;
43858 texture.image = images;
43862 texture.image.width = texDatas.width;
43863 texture.image.height = texDatas.height;
43864 texture.mipmaps = texDatas.mipmaps;
43868 if ( texDatas.mipmapCount === 1 ) {
43870 texture.minFilter = LinearFilter;
43874 texture.format = texDatas.format;
43875 texture.needsUpdate = true;
43877 if ( onLoad ) onLoad( texture );
43879 }, onProgress, onError );
43889 class ImageLoader extends Loader {
43891 constructor( manager ) {
43897 load( url, onLoad, onProgress, onError ) {
43899 if ( this.path !== undefined ) url = this.path + url;
43901 url = this.manager.resolveURL( url );
43903 const scope = this;
43905 const cached = Cache.get( url );
43907 if ( cached !== undefined ) {
43909 scope.manager.itemStart( url );
43911 setTimeout( function () {
43913 if ( onLoad ) onLoad( cached );
43915 scope.manager.itemEnd( url );
43923 const image = createElementNS( 'img' );
43925 function onImageLoad() {
43927 removeEventListeners();
43929 Cache.add( url, this );
43931 if ( onLoad ) onLoad( this );
43933 scope.manager.itemEnd( url );
43937 function onImageError( event ) {
43939 removeEventListeners();
43941 if ( onError ) onError( event );
43943 scope.manager.itemError( url );
43944 scope.manager.itemEnd( url );
43948 function removeEventListeners() {
43950 image.removeEventListener( 'load', onImageLoad, false );
43951 image.removeEventListener( 'error', onImageError, false );
43955 image.addEventListener( 'load', onImageLoad, false );
43956 image.addEventListener( 'error', onImageError, false );
43958 if ( url.slice( 0, 5 ) !== 'data:' ) {
43960 if ( this.crossOrigin !== undefined ) image.crossOrigin = this.crossOrigin;
43964 scope.manager.itemStart( url );
43974 class CubeTextureLoader extends Loader {
43976 constructor( manager ) {
43982 load( urls, onLoad, onProgress, onError ) {
43984 const texture = new CubeTexture();
43985 texture.colorSpace = SRGBColorSpace;
43987 const loader = new ImageLoader( this.manager );
43988 loader.setCrossOrigin( this.crossOrigin );
43989 loader.setPath( this.path );
43993 function loadTexture( i ) {
43995 loader.load( urls[ i ], function ( image ) {
43997 texture.images[ i ] = image;
44001 if ( loaded === 6 ) {
44003 texture.needsUpdate = true;
44005 if ( onLoad ) onLoad( texture );
44009 }, undefined, onError );
44013 for ( let i = 0; i < urls.length; ++ i ) {
44031 class DataTextureLoader extends Loader {
44033 constructor( manager ) {
44039 load( url, onLoad, onProgress, onError ) {
44041 const scope = this;
44043 const texture = new DataTexture();
44045 const loader = new FileLoader( this.manager );
44046 loader.setResponseType( 'arraybuffer' );
44047 loader.setRequestHeader( this.requestHeader );
44048 loader.setPath( this.path );
44049 loader.setWithCredentials( scope.withCredentials );
44050 loader.load( url, function ( buffer ) {
44056 texData = scope.parse( buffer );
44058 } catch ( error ) {
44060 if ( onError !== undefined ) {
44066 console.error( error );
44073 if ( texData.image !== undefined ) {
44075 texture.image = texData.image;
44077 } else if ( texData.data !== undefined ) {
44079 texture.image.width = texData.width;
44080 texture.image.height = texData.height;
44081 texture.image.data = texData.data;
44085 texture.wrapS = texData.wrapS !== undefined ? texData.wrapS : ClampToEdgeWrapping;
44086 texture.wrapT = texData.wrapT !== undefined ? texData.wrapT : ClampToEdgeWrapping;
44088 texture.magFilter = texData.magFilter !== undefined ? texData.magFilter : LinearFilter;
44089 texture.minFilter = texData.minFilter !== undefined ? texData.minFilter : LinearFilter;
44091 texture.anisotropy = texData.anisotropy !== undefined ? texData.anisotropy : 1;
44093 if ( texData.colorSpace !== undefined ) {
44095 texture.colorSpace = texData.colorSpace;
44097 } else if ( texData.encoding !== undefined ) { // @deprecated, r152
44099 texture.encoding = texData.encoding;
44103 if ( texData.flipY !== undefined ) {
44105 texture.flipY = texData.flipY;
44109 if ( texData.format !== undefined ) {
44111 texture.format = texData.format;
44115 if ( texData.type !== undefined ) {
44117 texture.type = texData.type;
44121 if ( texData.mipmaps !== undefined ) {
44123 texture.mipmaps = texData.mipmaps;
44124 texture.minFilter = LinearMipmapLinearFilter; // presumably...
44128 if ( texData.mipmapCount === 1 ) {
44130 texture.minFilter = LinearFilter;
44134 if ( texData.generateMipmaps !== undefined ) {
44136 texture.generateMipmaps = texData.generateMipmaps;
44140 texture.needsUpdate = true;
44142 if ( onLoad ) onLoad( texture, texData );
44144 }, onProgress, onError );
44153 class TextureLoader extends Loader {
44155 constructor( manager ) {
44161 load( url, onLoad, onProgress, onError ) {
44163 const texture = new Texture();
44165 const loader = new ImageLoader( this.manager );
44166 loader.setCrossOrigin( this.crossOrigin );
44167 loader.setPath( this.path );
44169 loader.load( url, function ( image ) {
44171 texture.image = image;
44172 texture.needsUpdate = true;
44174 if ( onLoad !== undefined ) {
44180 }, onProgress, onError );
44188 class Light extends Object3D {
44190 constructor( color, intensity = 1 ) {
44194 this.isLight = true;
44196 this.type = 'Light';
44198 this.color = new Color( color );
44199 this.intensity = intensity;
44205 // Empty here in base class; some subclasses override.
44209 copy( source, recursive ) {
44211 super.copy( source, recursive );
44213 this.color.copy( source.color );
44214 this.intensity = source.intensity;
44222 const data = super.toJSON( meta );
44224 data.object.color = this.color.getHex();
44225 data.object.intensity = this.intensity;
44227 if ( this.groundColor !== undefined ) data.object.groundColor = this.groundColor.getHex();
44229 if ( this.distance !== undefined ) data.object.distance = this.distance;
44230 if ( this.angle !== undefined ) data.object.angle = this.angle;
44231 if ( this.decay !== undefined ) data.object.decay = this.decay;
44232 if ( this.penumbra !== undefined ) data.object.penumbra = this.penumbra;
44234 if ( this.shadow !== undefined ) data.object.shadow = this.shadow.toJSON();
44242 class HemisphereLight extends Light {
44244 constructor( skyColor, groundColor, intensity ) {
44246 super( skyColor, intensity );
44248 this.isHemisphereLight = true;
44250 this.type = 'HemisphereLight';
44252 this.position.copy( Object3D.DEFAULT_UP );
44253 this.updateMatrix();
44255 this.groundColor = new Color( groundColor );
44259 copy( source, recursive ) {
44261 super.copy( source, recursive );
44263 this.groundColor.copy( source.groundColor );
44271 const _projScreenMatrix$1 = /*@__PURE__*/ new Matrix4();
44272 const _lightPositionWorld$1 = /*@__PURE__*/ new Vector3();
44273 const _lookTarget$1 = /*@__PURE__*/ new Vector3();
44275 class LightShadow {
44277 constructor( camera ) {
44279 this.camera = camera;
44282 this.normalBias = 0;
44284 this.blurSamples = 8;
44286 this.mapSize = new Vector2( 512, 512 );
44289 this.mapPass = null;
44290 this.matrix = new Matrix4();
44292 this.autoUpdate = true;
44293 this.needsUpdate = false;
44295 this._frustum = new Frustum();
44296 this._frameExtents = new Vector2( 1, 1 );
44298 this._viewportCount = 1;
44300 this._viewports = [
44302 new Vector4( 0, 0, 1, 1 )
44308 getViewportCount() {
44310 return this._viewportCount;
44316 return this._frustum;
44320 updateMatrices( light ) {
44322 const shadowCamera = this.camera;
44323 const shadowMatrix = this.matrix;
44325 _lightPositionWorld$1.setFromMatrixPosition( light.matrixWorld );
44326 shadowCamera.position.copy( _lightPositionWorld$1 );
44328 _lookTarget$1.setFromMatrixPosition( light.target.matrixWorld );
44329 shadowCamera.lookAt( _lookTarget$1 );
44330 shadowCamera.updateMatrixWorld();
44332 _projScreenMatrix$1.multiplyMatrices( shadowCamera.projectionMatrix, shadowCamera.matrixWorldInverse );
44333 this._frustum.setFromProjectionMatrix( _projScreenMatrix$1 );
44336 0.5, 0.0, 0.0, 0.5,
44337 0.0, 0.5, 0.0, 0.5,
44338 0.0, 0.0, 0.5, 0.5,
44342 shadowMatrix.multiply( _projScreenMatrix$1 );
44346 getViewport( viewportIndex ) {
44348 return this._viewports[ viewportIndex ];
44352 getFrameExtents() {
44354 return this._frameExtents;
44362 this.map.dispose();
44366 if ( this.mapPass ) {
44368 this.mapPass.dispose();
44376 this.camera = source.camera.clone();
44378 this.bias = source.bias;
44379 this.radius = source.radius;
44381 this.mapSize.copy( source.mapSize );
44389 return new this.constructor().copy( this );
44397 if ( this.bias !== 0 ) object.bias = this.bias;
44398 if ( this.normalBias !== 0 ) object.normalBias = this.normalBias;
44399 if ( this.radius !== 1 ) object.radius = this.radius;
44400 if ( this.mapSize.x !== 512 || this.mapSize.y !== 512 ) object.mapSize = this.mapSize.toArray();
44402 object.camera = this.camera.toJSON( false ).object;
44403 delete object.camera.matrix;
44411 class SpotLightShadow extends LightShadow {
44415 super( new PerspectiveCamera( 50, 1, 0.5, 500 ) );
44417 this.isSpotLightShadow = true;
44423 updateMatrices( light ) {
44425 const camera = this.camera;
44427 const fov = RAD2DEG * 2 * light.angle * this.focus;
44428 const aspect = this.mapSize.width / this.mapSize.height;
44429 const far = light.distance || camera.far;
44431 if ( fov !== camera.fov || aspect !== camera.aspect || far !== camera.far ) {
44434 camera.aspect = aspect;
44436 camera.updateProjectionMatrix();
44440 super.updateMatrices( light );
44446 super.copy( source );
44448 this.focus = source.focus;
44456 class SpotLight extends Light {
44458 constructor( color, intensity, distance = 0, angle = Math.PI / 3, penumbra = 0, decay = 2 ) {
44460 super( color, intensity );
44462 this.isSpotLight = true;
44464 this.type = 'SpotLight';
44466 this.position.copy( Object3D.DEFAULT_UP );
44467 this.updateMatrix();
44469 this.target = new Object3D();
44471 this.distance = distance;
44472 this.angle = angle;
44473 this.penumbra = penumbra;
44474 this.decay = decay;
44478 this.shadow = new SpotLightShadow();
44484 // compute the light's luminous power (in lumens) from its intensity (in candela)
44485 // by convention for a spotlight, luminous power (lm) = π * luminous intensity (cd)
44486 return this.intensity * Math.PI;
44490 set power( power ) {
44492 // set the light's intensity (in candela) from the desired luminous power (in lumens)
44493 this.intensity = power / Math.PI;
44499 this.shadow.dispose();
44503 copy( source, recursive ) {
44505 super.copy( source, recursive );
44507 this.distance = source.distance;
44508 this.angle = source.angle;
44509 this.penumbra = source.penumbra;
44510 this.decay = source.decay;
44512 this.target = source.target.clone();
44514 this.shadow = source.shadow.clone();
44522 const _projScreenMatrix = /*@__PURE__*/ new Matrix4();
44523 const _lightPositionWorld = /*@__PURE__*/ new Vector3();
44524 const _lookTarget = /*@__PURE__*/ new Vector3();
44526 class PointLightShadow extends LightShadow {
44530 super( new PerspectiveCamera( 90, 1, 0.5, 500 ) );
44532 this.isPointLightShadow = true;
44534 this._frameExtents = new Vector2( 4, 2 );
44536 this._viewportCount = 6;
44538 this._viewports = [
44539 // These viewports map a cube-map onto a 2D texture with the
44540 // following orientation:
44545 // X - Positive x direction
44546 // x - Negative x direction
44547 // Y - Positive y direction
44548 // y - Negative y direction
44549 // Z - Positive z direction
44550 // z - Negative z direction
44553 new Vector4( 2, 1, 1, 1 ),
44555 new Vector4( 0, 1, 1, 1 ),
44557 new Vector4( 3, 1, 1, 1 ),
44559 new Vector4( 1, 1, 1, 1 ),
44561 new Vector4( 3, 0, 1, 1 ),
44563 new Vector4( 1, 0, 1, 1 )
44566 this._cubeDirections = [
44567 new Vector3( 1, 0, 0 ), new Vector3( - 1, 0, 0 ), new Vector3( 0, 0, 1 ),
44568 new Vector3( 0, 0, - 1 ), new Vector3( 0, 1, 0 ), new Vector3( 0, - 1, 0 )
44572 new Vector3( 0, 1, 0 ), new Vector3( 0, 1, 0 ), new Vector3( 0, 1, 0 ),
44573 new Vector3( 0, 1, 0 ), new Vector3( 0, 0, 1 ), new Vector3( 0, 0, - 1 )
44578 updateMatrices( light, viewportIndex = 0 ) {
44580 const camera = this.camera;
44581 const shadowMatrix = this.matrix;
44583 const far = light.distance || camera.far;
44585 if ( far !== camera.far ) {
44588 camera.updateProjectionMatrix();
44592 _lightPositionWorld.setFromMatrixPosition( light.matrixWorld );
44593 camera.position.copy( _lightPositionWorld );
44595 _lookTarget.copy( camera.position );
44596 _lookTarget.add( this._cubeDirections[ viewportIndex ] );
44597 camera.up.copy( this._cubeUps[ viewportIndex ] );
44598 camera.lookAt( _lookTarget );
44599 camera.updateMatrixWorld();
44601 shadowMatrix.makeTranslation( - _lightPositionWorld.x, - _lightPositionWorld.y, - _lightPositionWorld.z );
44603 _projScreenMatrix.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse );
44604 this._frustum.setFromProjectionMatrix( _projScreenMatrix );
44610 class PointLight extends Light {
44612 constructor( color, intensity, distance = 0, decay = 2 ) {
44614 super( color, intensity );
44616 this.isPointLight = true;
44618 this.type = 'PointLight';
44620 this.distance = distance;
44621 this.decay = decay;
44623 this.shadow = new PointLightShadow();
44629 // compute the light's luminous power (in lumens) from its intensity (in candela)
44630 // for an isotropic light source, luminous power (lm) = 4 π luminous intensity (cd)
44631 return this.intensity * 4 * Math.PI;
44635 set power( power ) {
44637 // set the light's intensity (in candela) from the desired luminous power (in lumens)
44638 this.intensity = power / ( 4 * Math.PI );
44644 this.shadow.dispose();
44648 copy( source, recursive ) {
44650 super.copy( source, recursive );
44652 this.distance = source.distance;
44653 this.decay = source.decay;
44655 this.shadow = source.shadow.clone();
44663 class DirectionalLightShadow extends LightShadow {
44667 super( new OrthographicCamera( - 5, 5, 5, - 5, 0.5, 500 ) );
44669 this.isDirectionalLightShadow = true;
44675 class DirectionalLight extends Light {
44677 constructor( color, intensity ) {
44679 super( color, intensity );
44681 this.isDirectionalLight = true;
44683 this.type = 'DirectionalLight';
44685 this.position.copy( Object3D.DEFAULT_UP );
44686 this.updateMatrix();
44688 this.target = new Object3D();
44690 this.shadow = new DirectionalLightShadow();
44696 this.shadow.dispose();
44702 super.copy( source );
44704 this.target = source.target.clone();
44705 this.shadow = source.shadow.clone();
44713 class AmbientLight extends Light {
44715 constructor( color, intensity ) {
44717 super( color, intensity );
44719 this.isAmbientLight = true;
44721 this.type = 'AmbientLight';
44727 class RectAreaLight extends Light {
44729 constructor( color, intensity, width = 10, height = 10 ) {
44731 super( color, intensity );
44733 this.isRectAreaLight = true;
44735 this.type = 'RectAreaLight';
44737 this.width = width;
44738 this.height = height;
44744 // compute the light's luminous power (in lumens) from its intensity (in nits)
44745 return this.intensity * this.width * this.height * Math.PI;
44749 set power( power ) {
44751 // set the light's intensity (in nits) from the desired luminous power (in lumens)
44752 this.intensity = power / ( this.width * this.height * Math.PI );
44758 super.copy( source );
44760 this.width = source.width;
44761 this.height = source.height;
44769 const data = super.toJSON( meta );
44771 data.object.width = this.width;
44772 data.object.height = this.height;
44788 // 3-band SH defined by 9 coefficients
44790 class SphericalHarmonics3 {
44794 this.isSphericalHarmonics3 = true;
44796 this.coefficients = [];
44798 for ( let i = 0; i < 9; i ++ ) {
44800 this.coefficients.push( new Vector3() );
44806 set( coefficients ) {
44808 for ( let i = 0; i < 9; i ++ ) {
44810 this.coefficients[ i ].copy( coefficients[ i ] );
44820 for ( let i = 0; i < 9; i ++ ) {
44822 this.coefficients[ i ].set( 0, 0, 0 );
44830 // get the radiance in the direction of the normal
44831 // target is a Vector3
44832 getAt( normal, target ) {
44834 // normal is assumed to be unit length
44836 const x = normal.x, y = normal.y, z = normal.z;
44838 const coeff = this.coefficients;
44841 target.copy( coeff[ 0 ] ).multiplyScalar( 0.282095 );
44844 target.addScaledVector( coeff[ 1 ], 0.488603 * y );
44845 target.addScaledVector( coeff[ 2 ], 0.488603 * z );
44846 target.addScaledVector( coeff[ 3 ], 0.488603 * x );
44849 target.addScaledVector( coeff[ 4 ], 1.092548 * ( x * y ) );
44850 target.addScaledVector( coeff[ 5 ], 1.092548 * ( y * z ) );
44851 target.addScaledVector( coeff[ 6 ], 0.315392 * ( 3.0 * z * z - 1.0 ) );
44852 target.addScaledVector( coeff[ 7 ], 1.092548 * ( x * z ) );
44853 target.addScaledVector( coeff[ 8 ], 0.546274 * ( x * x - y * y ) );
44859 // get the irradiance (radiance convolved with cosine lobe) in the direction of the normal
44860 // target is a Vector3
44861 // https://graphics.stanford.edu/papers/envmap/envmap.pdf
44862 getIrradianceAt( normal, target ) {
44864 // normal is assumed to be unit length
44866 const x = normal.x, y = normal.y, z = normal.z;
44868 const coeff = this.coefficients;
44871 target.copy( coeff[ 0 ] ).multiplyScalar( 0.886227 ); // π * 0.282095
44874 target.addScaledVector( coeff[ 1 ], 2.0 * 0.511664 * y ); // ( 2 * π / 3 ) * 0.488603
44875 target.addScaledVector( coeff[ 2 ], 2.0 * 0.511664 * z );
44876 target.addScaledVector( coeff[ 3 ], 2.0 * 0.511664 * x );
44879 target.addScaledVector( coeff[ 4 ], 2.0 * 0.429043 * x * y ); // ( π / 4 ) * 1.092548
44880 target.addScaledVector( coeff[ 5 ], 2.0 * 0.429043 * y * z );
44881 target.addScaledVector( coeff[ 6 ], 0.743125 * z * z - 0.247708 ); // ( π / 4 ) * 0.315392 * 3
44882 target.addScaledVector( coeff[ 7 ], 2.0 * 0.429043 * x * z );
44883 target.addScaledVector( coeff[ 8 ], 0.429043 * ( x * x - y * y ) ); // ( π / 4 ) * 0.546274
44891 for ( let i = 0; i < 9; i ++ ) {
44893 this.coefficients[ i ].add( sh.coefficients[ i ] );
44901 addScaledSH( sh, s ) {
44903 for ( let i = 0; i < 9; i ++ ) {
44905 this.coefficients[ i ].addScaledVector( sh.coefficients[ i ], s );
44915 for ( let i = 0; i < 9; i ++ ) {
44917 this.coefficients[ i ].multiplyScalar( s );
44925 lerp( sh, alpha ) {
44927 for ( let i = 0; i < 9; i ++ ) {
44929 this.coefficients[ i ].lerp( sh.coefficients[ i ], alpha );
44939 for ( let i = 0; i < 9; i ++ ) {
44941 if ( ! this.coefficients[ i ].equals( sh.coefficients[ i ] ) ) {
44955 return this.set( sh.coefficients );
44961 return new this.constructor().copy( this );
44965 fromArray( array, offset = 0 ) {
44967 const coefficients = this.coefficients;
44969 for ( let i = 0; i < 9; i ++ ) {
44971 coefficients[ i ].fromArray( array, offset + ( i * 3 ) );
44979 toArray( array = [], offset = 0 ) {
44981 const coefficients = this.coefficients;
44983 for ( let i = 0; i < 9; i ++ ) {
44985 coefficients[ i ].toArray( array, offset + ( i * 3 ) );
44993 // evaluate the basis functions
44994 // shBasis is an Array[ 9 ]
44995 static getBasisAt( normal, shBasis ) {
44997 // normal is assumed to be unit length
44999 const x = normal.x, y = normal.y, z = normal.z;
45002 shBasis[ 0 ] = 0.282095;
45005 shBasis[ 1 ] = 0.488603 * y;
45006 shBasis[ 2 ] = 0.488603 * z;
45007 shBasis[ 3 ] = 0.488603 * x;
45010 shBasis[ 4 ] = 1.092548 * x * y;
45011 shBasis[ 5 ] = 1.092548 * y * z;
45012 shBasis[ 6 ] = 0.315392 * ( 3 * z * z - 1 );
45013 shBasis[ 7 ] = 1.092548 * x * z;
45014 shBasis[ 8 ] = 0.546274 * ( x * x - y * y );
45020 class LightProbe extends Light {
45022 constructor( sh = new SphericalHarmonics3(), intensity = 1 ) {
45024 super( undefined, intensity );
45026 this.isLightProbe = true;
45034 super.copy( source );
45036 this.sh.copy( source.sh );
45044 this.intensity = json.intensity; // TODO: Move this bit to Light.fromJSON();
45045 this.sh.fromArray( json.sh );
45053 const data = super.toJSON( meta );
45055 data.object.sh = this.sh.toArray();
45063 class MaterialLoader extends Loader {
45065 constructor( manager ) {
45068 this.textures = {};
45072 load( url, onLoad, onProgress, onError ) {
45074 const scope = this;
45076 const loader = new FileLoader( scope.manager );
45077 loader.setPath( scope.path );
45078 loader.setRequestHeader( scope.requestHeader );
45079 loader.setWithCredentials( scope.withCredentials );
45080 loader.load( url, function ( text ) {
45084 onLoad( scope.parse( JSON.parse( text ) ) );
45094 console.error( e );
45098 scope.manager.itemError( url );
45102 }, onProgress, onError );
45108 const textures = this.textures;
45110 function getTexture( name ) {
45112 if ( textures[ name ] === undefined ) {
45114 console.warn( 'THREE.MaterialLoader: Undefined texture', name );
45118 return textures[ name ];
45122 const material = MaterialLoader.createMaterialFromType( json.type );
45124 if ( json.uuid !== undefined ) material.uuid = json.uuid;
45125 if ( json.name !== undefined ) material.name = json.name;
45126 if ( json.color !== undefined && material.color !== undefined ) material.color.setHex( json.color );
45127 if ( json.roughness !== undefined ) material.roughness = json.roughness;
45128 if ( json.metalness !== undefined ) material.metalness = json.metalness;
45129 if ( json.sheen !== undefined ) material.sheen = json.sheen;
45130 if ( json.sheenColor !== undefined ) material.sheenColor = new Color().setHex( json.sheenColor );
45131 if ( json.sheenRoughness !== undefined ) material.sheenRoughness = json.sheenRoughness;
45132 if ( json.emissive !== undefined && material.emissive !== undefined ) material.emissive.setHex( json.emissive );
45133 if ( json.specular !== undefined && material.specular !== undefined ) material.specular.setHex( json.specular );
45134 if ( json.specularIntensity !== undefined ) material.specularIntensity = json.specularIntensity;
45135 if ( json.specularColor !== undefined && material.specularColor !== undefined ) material.specularColor.setHex( json.specularColor );
45136 if ( json.shininess !== undefined ) material.shininess = json.shininess;
45137 if ( json.clearcoat !== undefined ) material.clearcoat = json.clearcoat;
45138 if ( json.clearcoatRoughness !== undefined ) material.clearcoatRoughness = json.clearcoatRoughness;
45139 if ( json.iridescence !== undefined ) material.iridescence = json.iridescence;
45140 if ( json.iridescenceIOR !== undefined ) material.iridescenceIOR = json.iridescenceIOR;
45141 if ( json.iridescenceThicknessRange !== undefined ) material.iridescenceThicknessRange = json.iridescenceThicknessRange;
45142 if ( json.transmission !== undefined ) material.transmission = json.transmission;
45143 if ( json.thickness !== undefined ) material.thickness = json.thickness;
45144 if ( json.attenuationDistance !== undefined ) material.attenuationDistance = json.attenuationDistance;
45145 if ( json.attenuationColor !== undefined && material.attenuationColor !== undefined ) material.attenuationColor.setHex( json.attenuationColor );
45146 if ( json.anisotropy !== undefined ) material.anisotropy = json.anisotropy;
45147 if ( json.anisotropyRotation !== undefined ) material.anisotropyRotation = json.anisotropyRotation;
45148 if ( json.fog !== undefined ) material.fog = json.fog;
45149 if ( json.flatShading !== undefined ) material.flatShading = json.flatShading;
45150 if ( json.blending !== undefined ) material.blending = json.blending;
45151 if ( json.combine !== undefined ) material.combine = json.combine;
45152 if ( json.side !== undefined ) material.side = json.side;
45153 if ( json.shadowSide !== undefined ) material.shadowSide = json.shadowSide;
45154 if ( json.opacity !== undefined ) material.opacity = json.opacity;
45155 if ( json.transparent !== undefined ) material.transparent = json.transparent;
45156 if ( json.alphaTest !== undefined ) material.alphaTest = json.alphaTest;
45157 if ( json.alphaHash !== undefined ) material.alphaHash = json.alphaHash;
45158 if ( json.depthFunc !== undefined ) material.depthFunc = json.depthFunc;
45159 if ( json.depthTest !== undefined ) material.depthTest = json.depthTest;
45160 if ( json.depthWrite !== undefined ) material.depthWrite = json.depthWrite;
45161 if ( json.colorWrite !== undefined ) material.colorWrite = json.colorWrite;
45162 if ( json.blendSrc !== undefined ) material.blendSrc = json.blendSrc;
45163 if ( json.blendDst !== undefined ) material.blendDst = json.blendDst;
45164 if ( json.blendEquation !== undefined ) material.blendEquation = json.blendEquation;
45165 if ( json.blendSrcAlpha !== undefined ) material.blendSrcAlpha = json.blendSrcAlpha;
45166 if ( json.blendDstAlpha !== undefined ) material.blendDstAlpha = json.blendDstAlpha;
45167 if ( json.blendEquationAlpha !== undefined ) material.blendEquationAlpha = json.blendEquationAlpha;
45168 if ( json.blendColor !== undefined && material.blendColor !== undefined ) material.blendColor.setHex( json.blendColor );
45169 if ( json.blendAlpha !== undefined ) material.blendAlpha = json.blendAlpha;
45170 if ( json.stencilWriteMask !== undefined ) material.stencilWriteMask = json.stencilWriteMask;
45171 if ( json.stencilFunc !== undefined ) material.stencilFunc = json.stencilFunc;
45172 if ( json.stencilRef !== undefined ) material.stencilRef = json.stencilRef;
45173 if ( json.stencilFuncMask !== undefined ) material.stencilFuncMask = json.stencilFuncMask;
45174 if ( json.stencilFail !== undefined ) material.stencilFail = json.stencilFail;
45175 if ( json.stencilZFail !== undefined ) material.stencilZFail = json.stencilZFail;
45176 if ( json.stencilZPass !== undefined ) material.stencilZPass = json.stencilZPass;
45177 if ( json.stencilWrite !== undefined ) material.stencilWrite = json.stencilWrite;
45179 if ( json.wireframe !== undefined ) material.wireframe = json.wireframe;
45180 if ( json.wireframeLinewidth !== undefined ) material.wireframeLinewidth = json.wireframeLinewidth;
45181 if ( json.wireframeLinecap !== undefined ) material.wireframeLinecap = json.wireframeLinecap;
45182 if ( json.wireframeLinejoin !== undefined ) material.wireframeLinejoin = json.wireframeLinejoin;
45184 if ( json.rotation !== undefined ) material.rotation = json.rotation;
45186 if ( json.linewidth !== undefined ) material.linewidth = json.linewidth;
45187 if ( json.dashSize !== undefined ) material.dashSize = json.dashSize;
45188 if ( json.gapSize !== undefined ) material.gapSize = json.gapSize;
45189 if ( json.scale !== undefined ) material.scale = json.scale;
45191 if ( json.polygonOffset !== undefined ) material.polygonOffset = json.polygonOffset;
45192 if ( json.polygonOffsetFactor !== undefined ) material.polygonOffsetFactor = json.polygonOffsetFactor;
45193 if ( json.polygonOffsetUnits !== undefined ) material.polygonOffsetUnits = json.polygonOffsetUnits;
45195 if ( json.dithering !== undefined ) material.dithering = json.dithering;
45197 if ( json.alphaToCoverage !== undefined ) material.alphaToCoverage = json.alphaToCoverage;
45198 if ( json.premultipliedAlpha !== undefined ) material.premultipliedAlpha = json.premultipliedAlpha;
45199 if ( json.forceSinglePass !== undefined ) material.forceSinglePass = json.forceSinglePass;
45201 if ( json.visible !== undefined ) material.visible = json.visible;
45203 if ( json.toneMapped !== undefined ) material.toneMapped = json.toneMapped;
45205 if ( json.userData !== undefined ) material.userData = json.userData;
45207 if ( json.vertexColors !== undefined ) {
45209 if ( typeof json.vertexColors === 'number' ) {
45211 material.vertexColors = ( json.vertexColors > 0 ) ? true : false;
45215 material.vertexColors = json.vertexColors;
45223 if ( json.uniforms !== undefined ) {
45225 for ( const name in json.uniforms ) {
45227 const uniform = json.uniforms[ name ];
45229 material.uniforms[ name ] = {};
45231 switch ( uniform.type ) {
45234 material.uniforms[ name ].value = getTexture( uniform.value );
45238 material.uniforms[ name ].value = new Color().setHex( uniform.value );
45242 material.uniforms[ name ].value = new Vector2().fromArray( uniform.value );
45246 material.uniforms[ name ].value = new Vector3().fromArray( uniform.value );
45250 material.uniforms[ name ].value = new Vector4().fromArray( uniform.value );
45254 material.uniforms[ name ].value = new Matrix3().fromArray( uniform.value );
45258 material.uniforms[ name ].value = new Matrix4().fromArray( uniform.value );
45262 material.uniforms[ name ].value = uniform.value;
45270 if ( json.defines !== undefined ) material.defines = json.defines;
45271 if ( json.vertexShader !== undefined ) material.vertexShader = json.vertexShader;
45272 if ( json.fragmentShader !== undefined ) material.fragmentShader = json.fragmentShader;
45273 if ( json.glslVersion !== undefined ) material.glslVersion = json.glslVersion;
45275 if ( json.extensions !== undefined ) {
45277 for ( const key in json.extensions ) {
45279 material.extensions[ key ] = json.extensions[ key ];
45285 if ( json.lights !== undefined ) material.lights = json.lights;
45286 if ( json.clipping !== undefined ) material.clipping = json.clipping;
45288 // for PointsMaterial
45290 if ( json.size !== undefined ) material.size = json.size;
45291 if ( json.sizeAttenuation !== undefined ) material.sizeAttenuation = json.sizeAttenuation;
45295 if ( json.map !== undefined ) material.map = getTexture( json.map );
45296 if ( json.matcap !== undefined ) material.matcap = getTexture( json.matcap );
45298 if ( json.alphaMap !== undefined ) material.alphaMap = getTexture( json.alphaMap );
45300 if ( json.bumpMap !== undefined ) material.bumpMap = getTexture( json.bumpMap );
45301 if ( json.bumpScale !== undefined ) material.bumpScale = json.bumpScale;
45303 if ( json.normalMap !== undefined ) material.normalMap = getTexture( json.normalMap );
45304 if ( json.normalMapType !== undefined ) material.normalMapType = json.normalMapType;
45305 if ( json.normalScale !== undefined ) {
45307 let normalScale = json.normalScale;
45309 if ( Array.isArray( normalScale ) === false ) {
45311 // Blender exporter used to export a scalar. See #7459
45313 normalScale = [ normalScale, normalScale ];
45317 material.normalScale = new Vector2().fromArray( normalScale );
45321 if ( json.displacementMap !== undefined ) material.displacementMap = getTexture( json.displacementMap );
45322 if ( json.displacementScale !== undefined ) material.displacementScale = json.displacementScale;
45323 if ( json.displacementBias !== undefined ) material.displacementBias = json.displacementBias;
45325 if ( json.roughnessMap !== undefined ) material.roughnessMap = getTexture( json.roughnessMap );
45326 if ( json.metalnessMap !== undefined ) material.metalnessMap = getTexture( json.metalnessMap );
45328 if ( json.emissiveMap !== undefined ) material.emissiveMap = getTexture( json.emissiveMap );
45329 if ( json.emissiveIntensity !== undefined ) material.emissiveIntensity = json.emissiveIntensity;
45331 if ( json.specularMap !== undefined ) material.specularMap = getTexture( json.specularMap );
45332 if ( json.specularIntensityMap !== undefined ) material.specularIntensityMap = getTexture( json.specularIntensityMap );
45333 if ( json.specularColorMap !== undefined ) material.specularColorMap = getTexture( json.specularColorMap );
45335 if ( json.envMap !== undefined ) material.envMap = getTexture( json.envMap );
45336 if ( json.envMapIntensity !== undefined ) material.envMapIntensity = json.envMapIntensity;
45338 if ( json.reflectivity !== undefined ) material.reflectivity = json.reflectivity;
45339 if ( json.refractionRatio !== undefined ) material.refractionRatio = json.refractionRatio;
45341 if ( json.lightMap !== undefined ) material.lightMap = getTexture( json.lightMap );
45342 if ( json.lightMapIntensity !== undefined ) material.lightMapIntensity = json.lightMapIntensity;
45344 if ( json.aoMap !== undefined ) material.aoMap = getTexture( json.aoMap );
45345 if ( json.aoMapIntensity !== undefined ) material.aoMapIntensity = json.aoMapIntensity;
45347 if ( json.gradientMap !== undefined ) material.gradientMap = getTexture( json.gradientMap );
45349 if ( json.clearcoatMap !== undefined ) material.clearcoatMap = getTexture( json.clearcoatMap );
45350 if ( json.clearcoatRoughnessMap !== undefined ) material.clearcoatRoughnessMap = getTexture( json.clearcoatRoughnessMap );
45351 if ( json.clearcoatNormalMap !== undefined ) material.clearcoatNormalMap = getTexture( json.clearcoatNormalMap );
45352 if ( json.clearcoatNormalScale !== undefined ) material.clearcoatNormalScale = new Vector2().fromArray( json.clearcoatNormalScale );
45354 if ( json.iridescenceMap !== undefined ) material.iridescenceMap = getTexture( json.iridescenceMap );
45355 if ( json.iridescenceThicknessMap !== undefined ) material.iridescenceThicknessMap = getTexture( json.iridescenceThicknessMap );
45357 if ( json.transmissionMap !== undefined ) material.transmissionMap = getTexture( json.transmissionMap );
45358 if ( json.thicknessMap !== undefined ) material.thicknessMap = getTexture( json.thicknessMap );
45360 if ( json.anisotropyMap !== undefined ) material.anisotropyMap = getTexture( json.anisotropyMap );
45362 if ( json.sheenColorMap !== undefined ) material.sheenColorMap = getTexture( json.sheenColorMap );
45363 if ( json.sheenRoughnessMap !== undefined ) material.sheenRoughnessMap = getTexture( json.sheenRoughnessMap );
45369 setTextures( value ) {
45371 this.textures = value;
45376 static createMaterialFromType( type ) {
45378 const materialLib = {
45384 MeshPhysicalMaterial,
45385 MeshStandardMaterial,
45388 MeshNormalMaterial,
45389 MeshLambertMaterial,
45391 MeshDistanceMaterial,
45393 MeshMatcapMaterial,
45394 LineDashedMaterial,
45399 return new materialLib[ type ]();
45405 class LoaderUtils {
45407 static decodeText( array ) {
45409 if ( typeof TextDecoder !== 'undefined' ) {
45411 return new TextDecoder().decode( array );
45415 // Avoid the String.fromCharCode.apply(null, array) shortcut, which
45420 for ( let i = 0, il = array.length; i < il; i ++ ) {
45422 // Implicitly assumes little-endian.
45423 s += String.fromCharCode( array[ i ] );
45429 // merges multi-byte utf-8 characters.
45431 return decodeURIComponent( escape( s ) );
45433 } catch ( e ) { // see #16358
45441 static extractUrlBase( url ) {
45443 const index = url.lastIndexOf( '/' );
45445 if ( index === - 1 ) return './';
45447 return url.slice( 0, index + 1 );
45451 static resolveURL( url, path ) {
45454 if ( typeof url !== 'string' || url === '' ) return '';
45456 // Host Relative URL
45457 if ( /^https?:\/\//i.test( path ) && /^\//.test( url ) ) {
45459 path = path.replace( /(^https?:\/\/[^\/]+).*/i, '$1' );
45463 // Absolute URL http://,https://,//
45464 if ( /^(https?:)?\/\//i.test( url ) ) return url;
45467 if ( /^data:.*,.*$/i.test( url ) ) return url;
45470 if ( /^blob:.*$/i.test( url ) ) return url;
45479 class InstancedBufferGeometry extends BufferGeometry {
45485 this.isInstancedBufferGeometry = true;
45487 this.type = 'InstancedBufferGeometry';
45488 this.instanceCount = Infinity;
45494 super.copy( source );
45496 this.instanceCount = source.instanceCount;
45504 const data = super.toJSON();
45506 data.instanceCount = this.instanceCount;
45508 data.isInstancedBufferGeometry = true;
45516 class BufferGeometryLoader extends Loader {
45518 constructor( manager ) {
45524 load( url, onLoad, onProgress, onError ) {
45526 const scope = this;
45528 const loader = new FileLoader( scope.manager );
45529 loader.setPath( scope.path );
45530 loader.setRequestHeader( scope.requestHeader );
45531 loader.setWithCredentials( scope.withCredentials );
45532 loader.load( url, function ( text ) {
45536 onLoad( scope.parse( JSON.parse( text ) ) );
45546 console.error( e );
45550 scope.manager.itemError( url );
45554 }, onProgress, onError );
45560 const interleavedBufferMap = {};
45561 const arrayBufferMap = {};
45563 function getInterleavedBuffer( json, uuid ) {
45565 if ( interleavedBufferMap[ uuid ] !== undefined ) return interleavedBufferMap[ uuid ];
45567 const interleavedBuffers = json.interleavedBuffers;
45568 const interleavedBuffer = interleavedBuffers[ uuid ];
45570 const buffer = getArrayBuffer( json, interleavedBuffer.buffer );
45572 const array = getTypedArray( interleavedBuffer.type, buffer );
45573 const ib = new InterleavedBuffer( array, interleavedBuffer.stride );
45574 ib.uuid = interleavedBuffer.uuid;
45576 interleavedBufferMap[ uuid ] = ib;
45582 function getArrayBuffer( json, uuid ) {
45584 if ( arrayBufferMap[ uuid ] !== undefined ) return arrayBufferMap[ uuid ];
45586 const arrayBuffers = json.arrayBuffers;
45587 const arrayBuffer = arrayBuffers[ uuid ];
45589 const ab = new Uint32Array( arrayBuffer ).buffer;
45591 arrayBufferMap[ uuid ] = ab;
45597 const geometry = json.isInstancedBufferGeometry ? new InstancedBufferGeometry() : new BufferGeometry();
45599 const index = json.data.index;
45601 if ( index !== undefined ) {
45603 const typedArray = getTypedArray( index.type, index.array );
45604 geometry.setIndex( new BufferAttribute( typedArray, 1 ) );
45608 const attributes = json.data.attributes;
45610 for ( const key in attributes ) {
45612 const attribute = attributes[ key ];
45613 let bufferAttribute;
45615 if ( attribute.isInterleavedBufferAttribute ) {
45617 const interleavedBuffer = getInterleavedBuffer( json.data, attribute.data );
45618 bufferAttribute = new InterleavedBufferAttribute( interleavedBuffer, attribute.itemSize, attribute.offset, attribute.normalized );
45622 const typedArray = getTypedArray( attribute.type, attribute.array );
45623 const bufferAttributeConstr = attribute.isInstancedBufferAttribute ? InstancedBufferAttribute : BufferAttribute;
45624 bufferAttribute = new bufferAttributeConstr( typedArray, attribute.itemSize, attribute.normalized );
45628 if ( attribute.name !== undefined ) bufferAttribute.name = attribute.name;
45629 if ( attribute.usage !== undefined ) bufferAttribute.setUsage( attribute.usage );
45631 geometry.setAttribute( key, bufferAttribute );
45635 const morphAttributes = json.data.morphAttributes;
45637 if ( morphAttributes ) {
45639 for ( const key in morphAttributes ) {
45641 const attributeArray = morphAttributes[ key ];
45645 for ( let i = 0, il = attributeArray.length; i < il; i ++ ) {
45647 const attribute = attributeArray[ i ];
45648 let bufferAttribute;
45650 if ( attribute.isInterleavedBufferAttribute ) {
45652 const interleavedBuffer = getInterleavedBuffer( json.data, attribute.data );
45653 bufferAttribute = new InterleavedBufferAttribute( interleavedBuffer, attribute.itemSize, attribute.offset, attribute.normalized );
45657 const typedArray = getTypedArray( attribute.type, attribute.array );
45658 bufferAttribute = new BufferAttribute( typedArray, attribute.itemSize, attribute.normalized );
45662 if ( attribute.name !== undefined ) bufferAttribute.name = attribute.name;
45663 array.push( bufferAttribute );
45667 geometry.morphAttributes[ key ] = array;
45673 const morphTargetsRelative = json.data.morphTargetsRelative;
45675 if ( morphTargetsRelative ) {
45677 geometry.morphTargetsRelative = true;
45681 const groups = json.data.groups || json.data.drawcalls || json.data.offsets;
45683 if ( groups !== undefined ) {
45685 for ( let i = 0, n = groups.length; i !== n; ++ i ) {
45687 const group = groups[ i ];
45689 geometry.addGroup( group.start, group.count, group.materialIndex );
45695 const boundingSphere = json.data.boundingSphere;
45697 if ( boundingSphere !== undefined ) {
45699 const center = new Vector3();
45701 if ( boundingSphere.center !== undefined ) {
45703 center.fromArray( boundingSphere.center );
45707 geometry.boundingSphere = new Sphere( center, boundingSphere.radius );
45711 if ( json.name ) geometry.name = json.name;
45712 if ( json.userData ) geometry.userData = json.userData;
45720 class ObjectLoader extends Loader {
45722 constructor( manager ) {
45728 load( url, onLoad, onProgress, onError ) {
45730 const scope = this;
45732 const path = ( this.path === '' ) ? LoaderUtils.extractUrlBase( url ) : this.path;
45733 this.resourcePath = this.resourcePath || path;
45735 const loader = new FileLoader( this.manager );
45736 loader.setPath( this.path );
45737 loader.setRequestHeader( this.requestHeader );
45738 loader.setWithCredentials( this.withCredentials );
45739 loader.load( url, function ( text ) {
45745 json = JSON.parse( text );
45747 } catch ( error ) {
45749 if ( onError !== undefined ) onError( error );
45751 console.error( 'THREE:ObjectLoader: Can\'t parse ' + url + '.', error.message );
45757 const metadata = json.metadata;
45759 if ( metadata === undefined || metadata.type === undefined || metadata.type.toLowerCase() === 'geometry' ) {
45761 if ( onError !== undefined ) onError( new Error( 'THREE.ObjectLoader: Can\'t load ' + url ) );
45763 console.error( 'THREE.ObjectLoader: Can\'t load ' + url );
45768 scope.parse( json, onLoad );
45770 }, onProgress, onError );
45774 async loadAsync( url, onProgress ) {
45776 const scope = this;
45778 const path = ( this.path === '' ) ? LoaderUtils.extractUrlBase( url ) : this.path;
45779 this.resourcePath = this.resourcePath || path;
45781 const loader = new FileLoader( this.manager );
45782 loader.setPath( this.path );
45783 loader.setRequestHeader( this.requestHeader );
45784 loader.setWithCredentials( this.withCredentials );
45786 const text = await loader.loadAsync( url, onProgress );
45788 const json = JSON.parse( text );
45790 const metadata = json.metadata;
45792 if ( metadata === undefined || metadata.type === undefined || metadata.type.toLowerCase() === 'geometry' ) {
45794 throw new Error( 'THREE.ObjectLoader: Can\'t load ' + url );
45798 return await scope.parseAsync( json );
45802 parse( json, onLoad ) {
45804 const animations = this.parseAnimations( json.animations );
45805 const shapes = this.parseShapes( json.shapes );
45806 const geometries = this.parseGeometries( json.geometries, shapes );
45808 const images = this.parseImages( json.images, function () {
45810 if ( onLoad !== undefined ) onLoad( object );
45814 const textures = this.parseTextures( json.textures, images );
45815 const materials = this.parseMaterials( json.materials, textures );
45817 const object = this.parseObject( json.object, geometries, materials, textures, animations );
45818 const skeletons = this.parseSkeletons( json.skeletons, object );
45820 this.bindSkeletons( object, skeletons );
45824 if ( onLoad !== undefined ) {
45826 let hasImages = false;
45828 for ( const uuid in images ) {
45830 if ( images[ uuid ].data instanceof HTMLImageElement ) {
45839 if ( hasImages === false ) onLoad( object );
45847 async parseAsync( json ) {
45849 const animations = this.parseAnimations( json.animations );
45850 const shapes = this.parseShapes( json.shapes );
45851 const geometries = this.parseGeometries( json.geometries, shapes );
45853 const images = await this.parseImagesAsync( json.images );
45855 const textures = this.parseTextures( json.textures, images );
45856 const materials = this.parseMaterials( json.materials, textures );
45858 const object = this.parseObject( json.object, geometries, materials, textures, animations );
45859 const skeletons = this.parseSkeletons( json.skeletons, object );
45861 this.bindSkeletons( object, skeletons );
45867 parseShapes( json ) {
45871 if ( json !== undefined ) {
45873 for ( let i = 0, l = json.length; i < l; i ++ ) {
45875 const shape = new Shape().fromJSON( json[ i ] );
45877 shapes[ shape.uuid ] = shape;
45887 parseSkeletons( json, object ) {
45889 const skeletons = {};
45892 // generate bone lookup table
45894 object.traverse( function ( child ) {
45896 if ( child.isBone ) bones[ child.uuid ] = child;
45900 // create skeletons
45902 if ( json !== undefined ) {
45904 for ( let i = 0, l = json.length; i < l; i ++ ) {
45906 const skeleton = new Skeleton().fromJSON( json[ i ], bones );
45908 skeletons[ skeleton.uuid ] = skeleton;
45918 parseGeometries( json, shapes ) {
45920 const geometries = {};
45922 if ( json !== undefined ) {
45924 const bufferGeometryLoader = new BufferGeometryLoader();
45926 for ( let i = 0, l = json.length; i < l; i ++ ) {
45929 const data = json[ i ];
45931 switch ( data.type ) {
45933 case 'BufferGeometry':
45934 case 'InstancedBufferGeometry':
45936 geometry = bufferGeometryLoader.parse( data );
45941 if ( data.type in Geometries ) {
45943 geometry = Geometries[ data.type ].fromJSON( data, shapes );
45947 console.warn( `THREE.ObjectLoader: Unsupported geometry type "${
data.type }
"` );
45953 geometry.uuid = data.uuid;
45955 if ( data.name !== undefined ) geometry.name = data.name;
45956 if ( data.userData !== undefined ) geometry.userData = data.userData;
45958 geometries[ data.uuid ] = geometry;
45968 parseMaterials( json, textures ) {
45970 const cache = {}; // MultiMaterial
45971 const materials = {};
45973 if ( json !== undefined ) {
45975 const loader = new MaterialLoader();
45976 loader.setTextures( textures );
45978 for ( let i = 0, l = json.length; i < l; i ++ ) {
45980 const data = json[ i ];
45982 if ( cache[ data.uuid ] === undefined ) {
45984 cache[ data.uuid ] = loader.parse( data );
45988 materials[ data.uuid ] = cache[ data.uuid ];
45998 parseAnimations( json ) {
46000 const animations = {};
46002 if ( json !== undefined ) {
46004 for ( let i = 0; i < json.length; i ++ ) {
46006 const data = json[ i ];
46008 const clip = AnimationClip.parse( data );
46010 animations[ clip.uuid ] = clip;
46020 parseImages( json, onLoad ) {
46022 const scope = this;
46027 function loadImage( url ) {
46029 scope.manager.itemStart( url );
46031 return loader.load( url, function () {
46033 scope.manager.itemEnd( url );
46035 }, undefined, function () {
46037 scope.manager.itemError( url );
46038 scope.manager.itemEnd( url );
46044 function deserializeImage( image ) {
46046 if ( typeof image === 'string' ) {
46050 const path = /^(\/\/)|([a-z]+:(\/\/)?)/i.test( url ) ? url : scope.resourcePath + url;
46052 return loadImage( path );
46056 if ( image.data ) {
46059 data: getTypedArray( image.type, image.data ),
46060 width: image.width,
46061 height: image.height
46074 if ( json !== undefined && json.length > 0 ) {
46076 const manager = new LoadingManager( onLoad );
46078 loader = new ImageLoader( manager );
46079 loader.setCrossOrigin( this.crossOrigin );
46081 for ( let i = 0, il = json.length; i < il; i ++ ) {
46083 const image = json[ i ];
46084 const url = image.url;
46086 if ( Array.isArray( url ) ) {
46088 // load array of images e.g CubeTexture
46090 const imageArray = [];
46092 for ( let j = 0, jl = url.length; j < jl; j ++ ) {
46094 const currentUrl = url[ j ];
46096 const deserializedImage = deserializeImage( currentUrl );
46098 if ( deserializedImage !== null ) {
46100 if ( deserializedImage instanceof HTMLImageElement ) {
46102 imageArray.push( deserializedImage );
46106 // special case: handle array of data textures for cube textures
46108 imageArray.push( new DataTexture( deserializedImage.data, deserializedImage.width, deserializedImage.height ) );
46116 images[ image.uuid ] = new Source( imageArray );
46120 // load single image
46122 const deserializedImage = deserializeImage( image.url );
46123 images[ image.uuid ] = new Source( deserializedImage );
46136 async parseImagesAsync( json ) {
46138 const scope = this;
46143 async function deserializeImage( image ) {
46145 if ( typeof image === 'string' ) {
46149 const path = /^(\/\/)|([a-z]+:(\/\/)?)/i.test( url ) ? url : scope.resourcePath + url;
46151 return await loader.loadAsync( path );
46155 if ( image.data ) {
46158 data: getTypedArray( image.type, image.data ),
46159 width: image.width,
46160 height: image.height
46173 if ( json !== undefined && json.length > 0 ) {
46175 loader = new ImageLoader( this.manager );
46176 loader.setCrossOrigin( this.crossOrigin );
46178 for ( let i = 0, il = json.length; i < il; i ++ ) {
46180 const image = json[ i ];
46181 const url = image.url;
46183 if ( Array.isArray( url ) ) {
46185 // load array of images e.g CubeTexture
46187 const imageArray = [];
46189 for ( let j = 0, jl = url.length; j < jl; j ++ ) {
46191 const currentUrl = url[ j ];
46193 const deserializedImage = await deserializeImage( currentUrl );
46195 if ( deserializedImage !== null ) {
46197 if ( deserializedImage instanceof HTMLImageElement ) {
46199 imageArray.push( deserializedImage );
46203 // special case: handle array of data textures for cube textures
46205 imageArray.push( new DataTexture( deserializedImage.data, deserializedImage.width, deserializedImage.height ) );
46213 images[ image.uuid ] = new Source( imageArray );
46217 // load single image
46219 const deserializedImage = await deserializeImage( image.url );
46220 images[ image.uuid ] = new Source( deserializedImage );
46232 parseTextures( json, images ) {
46234 function parseConstant( value, type ) {
46236 if ( typeof value === 'number' ) return value;
46238 console.warn( 'THREE.ObjectLoader.parseTexture: Constant should be in numeric form.', value );
46240 return type[ value ];
46244 const textures = {};
46246 if ( json !== undefined ) {
46248 for ( let i = 0, l = json.length; i < l; i ++ ) {
46250 const data = json[ i ];
46252 if ( data.image === undefined ) {
46254 console.warn( 'THREE.ObjectLoader: No "image" specified for', data.uuid );
46258 if ( images[ data.image ] === undefined ) {
46260 console.warn( 'THREE.ObjectLoader: Undefined image', data.image );
46264 const source = images[ data.image ];
46265 const image = source.data;
46269 if ( Array.isArray( image ) ) {
46271 texture = new CubeTexture();
46273 if ( image.length === 6 ) texture.needsUpdate = true;
46277 if ( image && image.data ) {
46279 texture = new DataTexture();
46283 texture = new Texture();
46287 if ( image ) texture.needsUpdate = true; // textures can have undefined image data
46291 texture.source = source;
46293 texture.uuid = data.uuid;
46295 if ( data.name !== undefined ) texture.name = data.name;
46297 if ( data.mapping !== undefined ) texture.mapping = parseConstant( data.mapping, TEXTURE_MAPPING );
46298 if ( data.channel !== undefined ) texture.channel = data.channel;
46300 if ( data.offset !== undefined ) texture.offset.fromArray( data.offset );
46301 if ( data.repeat !== undefined ) texture.repeat.fromArray( data.repeat );
46302 if ( data.center !== undefined ) texture.center.fromArray( data.center );
46303 if ( data.rotation !== undefined ) texture.rotation = data.rotation;
46305 if ( data.wrap !== undefined ) {
46307 texture.wrapS = parseConstant( data.wrap[ 0 ], TEXTURE_WRAPPING );
46308 texture.wrapT = parseConstant( data.wrap[ 1 ], TEXTURE_WRAPPING );
46312 if ( data.format !== undefined ) texture.format = data.format;
46313 if ( data.internalFormat !== undefined ) texture.internalFormat = data.internalFormat;
46314 if ( data.type !== undefined ) texture.type = data.type;
46315 if ( data.colorSpace !== undefined ) texture.colorSpace = data.colorSpace;
46316 if ( data.encoding !== undefined ) texture.encoding = data.encoding; // @deprecated, r152
46318 if ( data.minFilter !== undefined ) texture.minFilter = parseConstant( data.minFilter, TEXTURE_FILTER );
46319 if ( data.magFilter !== undefined ) texture.magFilter = parseConstant( data.magFilter, TEXTURE_FILTER );
46320 if ( data.anisotropy !== undefined ) texture.anisotropy = data.anisotropy;
46322 if ( data.flipY !== undefined ) texture.flipY = data.flipY;
46324 if ( data.generateMipmaps !== undefined ) texture.generateMipmaps = data.generateMipmaps;
46325 if ( data.premultiplyAlpha !== undefined ) texture.premultiplyAlpha = data.premultiplyAlpha;
46326 if ( data.unpackAlignment !== undefined ) texture.unpackAlignment = data.unpackAlignment;
46327 if ( data.compareFunction !== undefined ) texture.compareFunction = data.compareFunction;
46329 if ( data.userData !== undefined ) texture.userData = data.userData;
46331 textures[ data.uuid ] = texture;
46341 parseObject( data, geometries, materials, textures, animations ) {
46345 function getGeometry( name ) {
46347 if ( geometries[ name ] === undefined ) {
46349 console.warn( 'THREE.ObjectLoader: Undefined geometry', name );
46353 return geometries[ name ];
46357 function getMaterial( name ) {
46359 if ( name === undefined ) return undefined;
46361 if ( Array.isArray( name ) ) {
46365 for ( let i = 0, l = name.length; i < l; i ++ ) {
46367 const uuid = name[ i ];
46369 if ( materials[ uuid ] === undefined ) {
46371 console.warn( 'THREE.ObjectLoader: Undefined material', uuid );
46375 array.push( materials[ uuid ] );
46383 if ( materials[ name ] === undefined ) {
46385 console.warn( 'THREE.ObjectLoader: Undefined material', name );
46389 return materials[ name ];
46393 function getTexture( uuid ) {
46395 if ( textures[ uuid ] === undefined ) {
46397 console.warn( 'THREE.ObjectLoader: Undefined texture', uuid );
46401 return textures[ uuid ];
46405 let geometry, material;
46407 switch ( data.type ) {
46411 object = new Scene();
46413 if ( data.background !== undefined ) {
46415 if ( Number.isInteger( data.background ) ) {
46417 object.background = new Color( data.background );
46421 object.background = getTexture( data.background );
46427 if ( data.environment !== undefined ) {
46429 object.environment = getTexture( data.environment );
46433 if ( data.fog !== undefined ) {
46435 if ( data.fog.type === 'Fog' ) {
46437 object.fog = new Fog( data.fog.color, data.fog.near, data.fog.far );
46439 } else if ( data.fog.type === 'FogExp2' ) {
46441 object.fog = new FogExp2( data.fog.color, data.fog.density );
46445 if ( data.fog.name !== '' ) {
46447 object.fog.name = data.fog.name;
46453 if ( data.backgroundBlurriness !== undefined ) object.backgroundBlurriness = data.backgroundBlurriness;
46454 if ( data.backgroundIntensity !== undefined ) object.backgroundIntensity = data.backgroundIntensity;
46458 case 'PerspectiveCamera':
46460 object = new PerspectiveCamera( data.fov, data.aspect, data.near, data.far );
46462 if ( data.focus !== undefined ) object.focus = data.focus;
46463 if ( data.zoom !== undefined ) object.zoom = data.zoom;
46464 if ( data.filmGauge !== undefined ) object.filmGauge = data.filmGauge;
46465 if ( data.filmOffset !== undefined ) object.filmOffset = data.filmOffset;
46466 if ( data.view !== undefined ) object.view = Object.assign( {}, data.view );
46470 case 'OrthographicCamera':
46472 object = new OrthographicCamera( data.left, data.right, data.top, data.bottom, data.near, data.far );
46474 if ( data.zoom !== undefined ) object.zoom = data.zoom;
46475 if ( data.view !== undefined ) object.view = Object.assign( {}, data.view );
46479 case 'AmbientLight':
46481 object = new AmbientLight( data.color, data.intensity );
46485 case 'DirectionalLight':
46487 object = new DirectionalLight( data.color, data.intensity );
46493 object = new PointLight( data.color, data.intensity, data.distance, data.decay );
46497 case 'RectAreaLight':
46499 object = new RectAreaLight( data.color, data.intensity, data.width, data.height );
46505 object = new SpotLight( data.color, data.intensity, data.distance, data.angle, data.penumbra, data.decay );
46509 case 'HemisphereLight':
46511 object = new HemisphereLight( data.color, data.groundColor, data.intensity );
46517 object = new LightProbe().fromJSON( data );
46521 case 'SkinnedMesh':
46523 geometry = getGeometry( data.geometry );
46524 material = getMaterial( data.material );
46526 object = new SkinnedMesh( geometry, material );
46528 if ( data.bindMode !== undefined ) object.bindMode = data.bindMode;
46529 if ( data.bindMatrix !== undefined ) object.bindMatrix.fromArray( data.bindMatrix );
46530 if ( data.skeleton !== undefined ) object.skeleton = data.skeleton;
46536 geometry = getGeometry( data.geometry );
46537 material = getMaterial( data.material );
46539 object = new Mesh( geometry, material );
46543 case 'InstancedMesh':
46545 geometry = getGeometry( data.geometry );
46546 material = getMaterial( data.material );
46547 const count = data.count;
46548 const instanceMatrix = data.instanceMatrix;
46549 const instanceColor = data.instanceColor;
46551 object = new InstancedMesh( geometry, material, count );
46552 object.instanceMatrix = new InstancedBufferAttribute( new Float32Array( instanceMatrix.array ), 16 );
46553 if ( instanceColor !== undefined ) object.instanceColor = new InstancedBufferAttribute( new Float32Array( instanceColor.array ), instanceColor.itemSize );
46557 case 'BatchedMesh':
46559 geometry = getGeometry( data.geometry );
46560 material = getMaterial( data.material );
46562 object = new BatchedMesh( data.maxGeometryCount, data.maxVertexCount, data.maxIndexCount, material );
46563 object.geometry = geometry;
46564 object.perObjectFrustumCulled = data.perObjectFrustumCulled;
46565 object.sortObjects = data.sortObjects;
46567 object._drawRanges = data.drawRanges;
46568 object._reservedRanges = data.reservedRanges;
46570 object._visibility = data.visibility;
46571 object._active = data.active;
46572 object._bounds = data.bounds.map( bound => {
46574 const box = new Box3();
46575 box.min.fromArray( bound.boxMin );
46576 box.max.fromArray( bound.boxMax );
46578 const sphere = new Sphere();
46579 sphere.radius = bound.sphereRadius;
46580 sphere.center.fromArray( bound.sphereCenter );
46583 boxInitialized: bound.boxInitialized,
46586 sphereInitialized: bound.sphereInitialized,
46592 object._maxGeometryCount = data.maxGeometryCount;
46593 object._maxVertexCount = data.maxVertexCount;
46594 object._maxIndexCount = data.maxIndexCount;
46596 object._geometryInitialized = data.geometryInitialized;
46597 object._geometryCount = data.geometryCount;
46599 object._matricesTexture = getTexture( data.matricesTexture.uuid );
46605 object = new LOD();
46611 object = new Line( getGeometry( data.geometry ), getMaterial( data.material ) );
46617 object = new LineLoop( getGeometry( data.geometry ), getMaterial( data.material ) );
46621 case 'LineSegments':
46623 object = new LineSegments( getGeometry( data.geometry ), getMaterial( data.material ) );
46630 object = new Points( getGeometry( data.geometry ), getMaterial( data.material ) );
46636 object = new Sprite( getMaterial( data.material ) );
46642 object = new Group();
46648 object = new Bone();
46654 object = new Object3D();
46658 object.uuid = data.uuid;
46660 if ( data.name !== undefined ) object.name = data.name;
46662 if ( data.matrix !== undefined ) {
46664 object.matrix.fromArray( data.matrix );
46666 if ( data.matrixAutoUpdate !== undefined ) object.matrixAutoUpdate = data.matrixAutoUpdate;
46667 if ( object.matrixAutoUpdate ) object.matrix.decompose( object.position, object.quaternion, object.scale );
46671 if ( data.position !== undefined ) object.position.fromArray( data.position );
46672 if ( data.rotation !== undefined ) object.rotation.fromArray( data.rotation );
46673 if ( data.quaternion !== undefined ) object.quaternion.fromArray( data.quaternion );
46674 if ( data.scale !== undefined ) object.scale.fromArray( data.scale );
46678 if ( data.up !== undefined ) object.up.fromArray( data.up );
46680 if ( data.castShadow !== undefined ) object.castShadow = data.castShadow;
46681 if ( data.receiveShadow !== undefined ) object.receiveShadow = data.receiveShadow;
46683 if ( data.shadow ) {
46685 if ( data.shadow.bias !== undefined ) object.shadow.bias = data.shadow.bias;
46686 if ( data.shadow.normalBias !== undefined ) object.shadow.normalBias = data.shadow.normalBias;
46687 if ( data.shadow.radius !== undefined ) object.shadow.radius = data.shadow.radius;
46688 if ( data.shadow.mapSize !== undefined ) object.shadow.mapSize.fromArray( data.shadow.mapSize );
46689 if ( data.shadow.camera !== undefined ) object.shadow.camera = this.parseObject( data.shadow.camera );
46693 if ( data.visible !== undefined ) object.visible = data.visible;
46694 if ( data.frustumCulled !== undefined ) object.frustumCulled = data.frustumCulled;
46695 if ( data.renderOrder !== undefined ) object.renderOrder = data.renderOrder;
46696 if ( data.userData !== undefined ) object.userData = data.userData;
46697 if ( data.layers !== undefined ) object.layers.mask = data.layers;
46699 if ( data.children !== undefined ) {
46701 const children = data.children;
46703 for ( let i = 0; i < children.length; i ++ ) {
46705 object.add( this.parseObject( children[ i ], geometries, materials, textures, animations ) );
46711 if ( data.animations !== undefined ) {
46713 const objectAnimations = data.animations;
46715 for ( let i = 0; i < objectAnimations.length; i ++ ) {
46717 const uuid = objectAnimations[ i ];
46719 object.animations.push( animations[ uuid ] );
46725 if ( data.type === 'LOD' ) {
46727 if ( data.autoUpdate !== undefined ) object.autoUpdate = data.autoUpdate;
46729 const levels = data.levels;
46731 for ( let l = 0; l < levels.length; l ++ ) {
46733 const level = levels[ l ];
46734 const child = object.getObjectByProperty( 'uuid', level.object );
46736 if ( child !== undefined ) {
46738 object.addLevel( child, level.distance, level.hysteresis );
46750 bindSkeletons( object, skeletons ) {
46752 if ( Object.keys( skeletons ).length === 0 ) return;
46754 object.traverse( function ( child ) {
46756 if ( child.isSkinnedMesh === true && child.skeleton !== undefined ) {
46758 const skeleton = skeletons[ child.skeleton ];
46760 if ( skeleton === undefined ) {
46762 console.warn( 'THREE.ObjectLoader: No skeleton found with UUID:', child.skeleton );
46766 child.bind( skeleton, child.bindMatrix );
46778 const TEXTURE_MAPPING = {
46779 UVMapping: UVMapping,
46780 CubeReflectionMapping: CubeReflectionMapping,
46781 CubeRefractionMapping: CubeRefractionMapping,
46782 EquirectangularReflectionMapping: EquirectangularReflectionMapping,
46783 EquirectangularRefractionMapping: EquirectangularRefractionMapping,
46784 CubeUVReflectionMapping: CubeUVReflectionMapping
46787 const TEXTURE_WRAPPING = {
46788 RepeatWrapping: RepeatWrapping,
46789 ClampToEdgeWrapping: ClampToEdgeWrapping,
46790 MirroredRepeatWrapping: MirroredRepeatWrapping
46793 const TEXTURE_FILTER = {
46794 NearestFilter: NearestFilter,
46795 NearestMipmapNearestFilter: NearestMipmapNearestFilter,
46796 NearestMipmapLinearFilter: NearestMipmapLinearFilter,
46797 LinearFilter: LinearFilter,
46798 LinearMipmapNearestFilter: LinearMipmapNearestFilter,
46799 LinearMipmapLinearFilter: LinearMipmapLinearFilter
46802 class ImageBitmapLoader extends Loader {
46804 constructor( manager ) {
46808 this.isImageBitmapLoader = true;
46810 if ( typeof createImageBitmap === 'undefined' ) {
46812 console.warn( 'THREE.ImageBitmapLoader: createImageBitmap() not supported.' );
46816 if ( typeof fetch === 'undefined' ) {
46818 console.warn( 'THREE.ImageBitmapLoader: fetch() not supported.' );
46822 this.options = { premultiplyAlpha: 'none' };
46826 setOptions( options ) {
46828 this.options = options;
46834 load( url, onLoad, onProgress, onError ) {
46836 if ( url === undefined ) url = '';
46838 if ( this.path !== undefined ) url = this.path + url;
46840 url = this.manager.resolveURL( url );
46842 const scope = this;
46844 const cached = Cache.get( url );
46846 if ( cached !== undefined ) {
46848 scope.manager.itemStart( url );
46850 // If cached is a promise, wait for it to resolve
46851 if ( cached.then ) {
46853 cached.then( imageBitmap => {
46855 if ( onLoad ) onLoad( imageBitmap );
46857 scope.manager.itemEnd( url );
46861 if ( onError ) onError( e );
46868 // If cached is not a promise (i.e., it's already an imageBitmap)
46869 setTimeout( function () {
46871 if ( onLoad ) onLoad( cached );
46873 scope.manager.itemEnd( url );
46881 const fetchOptions = {};
46882 fetchOptions.credentials = ( this.crossOrigin === 'anonymous' ) ? 'same-origin' : 'include';
46883 fetchOptions.headers = this.requestHeader;
46885 const promise = fetch( url, fetchOptions ).then( function ( res ) {
46889 } ).then( function ( blob ) {
46891 return createImageBitmap( blob, Object.assign( scope.options, { colorSpaceConversion: 'none' } ) );
46893 } ).then( function ( imageBitmap ) {
46895 Cache.add( url, imageBitmap );
46897 if ( onLoad ) onLoad( imageBitmap );
46899 scope.manager.itemEnd( url );
46901 return imageBitmap;
46903 } ).catch( function ( e ) {
46905 if ( onError ) onError( e );
46907 Cache.remove( url );
46909 scope.manager.itemError( url );
46910 scope.manager.itemEnd( url );
46914 Cache.add( url, promise );
46915 scope.manager.itemStart( url );
46923 class AudioContext {
46925 static getContext() {
46927 if ( _context === undefined ) {
46929 _context = new ( window.AudioContext || window.webkitAudioContext )();
46937 static setContext( value ) {
46945 class AudioLoader extends Loader {
46947 constructor( manager ) {
46953 load( url, onLoad, onProgress, onError ) {
46955 const scope = this;
46957 const loader = new FileLoader( this.manager );
46958 loader.setResponseType( 'arraybuffer' );
46959 loader.setPath( this.path );
46960 loader.setRequestHeader( this.requestHeader );
46961 loader.setWithCredentials( this.withCredentials );
46962 loader.load( url, function ( buffer ) {
46966 // Create a copy of the buffer. The `decodeAudioData` method
46967 // detaches the buffer when complete, preventing reuse.
46968 const bufferCopy = buffer.slice( 0 );
46970 const context = AudioContext.getContext();
46971 context.decodeAudioData( bufferCopy, function ( audioBuffer ) {
46973 onLoad( audioBuffer );
46975 } ).catch( handleError );
46983 }, onProgress, onError );
46985 function handleError( e ) {
46993 console.error( e );
46997 scope.manager.itemError( url );
47005 const _eyeRight = /*@__PURE__*/ new Matrix4();
47006 const _eyeLeft = /*@__PURE__*/ new Matrix4();
47007 const _projectionMatrix = /*@__PURE__*/ new Matrix4();
47009 class StereoCamera {
47013 this.type = 'StereoCamera';
47017 this.eyeSep = 0.064;
47019 this.cameraL = new PerspectiveCamera();
47020 this.cameraL.layers.enable( 1 );
47021 this.cameraL.matrixAutoUpdate = false;
47023 this.cameraR = new PerspectiveCamera();
47024 this.cameraR.layers.enable( 2 );
47025 this.cameraR.matrixAutoUpdate = false;
47041 const cache = this._cache;
47043 const needsUpdate = cache.focus !== camera.focus || cache.fov !== camera.fov ||
47044 cache.aspect !== camera.aspect * this.aspect || cache.near !== camera.near ||
47045 cache.far !== camera.far || cache.zoom !== camera.zoom || cache.eyeSep !== this.eyeSep;
47047 if ( needsUpdate ) {
47049 cache.focus = camera.focus;
47050 cache.fov = camera.fov;
47051 cache.aspect = camera.aspect * this.aspect;
47052 cache.near = camera.near;
47053 cache.far = camera.far;
47054 cache.zoom = camera.zoom;
47055 cache.eyeSep = this.eyeSep;
47057 // Off-axis stereoscopic effect based on
47058 // http://paulbourke.net/stereographics/stereorender/
47060 _projectionMatrix.copy( camera.projectionMatrix );
47061 const eyeSepHalf = cache.eyeSep / 2;
47062 const eyeSepOnProjection = eyeSepHalf * cache.near / cache.focus;
47063 const ymax = ( cache.near * Math.tan( DEG2RAD * cache.fov * 0.5 ) ) / cache.zoom;
47066 // translate xOffset
47068 _eyeLeft.elements[ 12 ] = - eyeSepHalf;
47069 _eyeRight.elements[ 12 ] = eyeSepHalf;
47073 xmin = - ymax * cache.aspect + eyeSepOnProjection;
47074 xmax = ymax * cache.aspect + eyeSepOnProjection;
47076 _projectionMatrix.elements[ 0 ] = 2 * cache.near / ( xmax - xmin );
47077 _projectionMatrix.elements[ 8 ] = ( xmax + xmin ) / ( xmax - xmin );
47079 this.cameraL.projectionMatrix.copy( _projectionMatrix );
47083 xmin = - ymax * cache.aspect - eyeSepOnProjection;
47084 xmax = ymax * cache.aspect - eyeSepOnProjection;
47086 _projectionMatrix.elements[ 0 ] = 2 * cache.near / ( xmax - xmin );
47087 _projectionMatrix.elements[ 8 ] = ( xmax + xmin ) / ( xmax - xmin );
47089 this.cameraR.projectionMatrix.copy( _projectionMatrix );
47093 this.cameraL.matrixWorld.copy( camera.matrixWorld ).multiply( _eyeLeft );
47094 this.cameraR.matrixWorld.copy( camera.matrixWorld ).multiply( _eyeRight );
47102 constructor( autoStart = true ) {
47104 this.autoStart = autoStart;
47106 this.startTime = 0;
47108 this.elapsedTime = 0;
47110 this.running = false;
47116 this.startTime = now();
47118 this.oldTime = this.startTime;
47119 this.elapsedTime = 0;
47120 this.running = true;
47126 this.getElapsedTime();
47127 this.running = false;
47128 this.autoStart = false;
47135 return this.elapsedTime;
47143 if ( this.autoStart && ! this.running ) {
47150 if ( this.running ) {
47152 const newTime = now();
47154 diff = ( newTime - this.oldTime ) / 1000;
47155 this.oldTime = newTime;
47157 this.elapsedTime += diff;
47169 return ( typeof performance === 'undefined' ? Date : performance ).now(); // see #10732
47173 const _position$1 = /*@__PURE__*/ new Vector3();
47174 const _quaternion$1 = /*@__PURE__*/ new Quaternion();
47175 const _scale$1 = /*@__PURE__*/ new Vector3();
47176 const _orientation$1 = /*@__PURE__*/ new Vector3();
47178 class AudioListener extends Object3D {
47184 this.type = 'AudioListener';
47186 this.context = AudioContext.getContext();
47188 this.gain = this.context.createGain();
47189 this.gain.connect( this.context.destination );
47191 this.filter = null;
47193 this.timeDelta = 0;
47197 this._clock = new Clock();
47209 if ( this.filter !== null ) {
47211 this.gain.disconnect( this.filter );
47212 this.filter.disconnect( this.context.destination );
47213 this.gain.connect( this.context.destination );
47214 this.filter = null;
47224 return this.filter;
47228 setFilter( value ) {
47230 if ( this.filter !== null ) {
47232 this.gain.disconnect( this.filter );
47233 this.filter.disconnect( this.context.destination );
47237 this.gain.disconnect( this.context.destination );
47241 this.filter = value;
47242 this.gain.connect( this.filter );
47243 this.filter.connect( this.context.destination );
47249 getMasterVolume() {
47251 return this.gain.gain.value;
47255 setMasterVolume( value ) {
47257 this.gain.gain.setTargetAtTime( value, this.context.currentTime, 0.01 );
47263 updateMatrixWorld( force ) {
47265 super.updateMatrixWorld( force );
47267 const listener = this.context.listener;
47268 const up = this.up;
47270 this.timeDelta = this._clock.getDelta();
47272 this.matrixWorld.decompose( _position$1, _quaternion$1, _scale$1 );
47274 _orientation$1.set( 0, 0, - 1 ).applyQuaternion( _quaternion$1 );
47276 if ( listener.positionX ) {
47278 // code path for Chrome (see #14393)
47280 const endTime = this.context.currentTime + this.timeDelta;
47282 listener.positionX.linearRampToValueAtTime( _position$1.x, endTime );
47283 listener.positionY.linearRampToValueAtTime( _position$1.y, endTime );
47284 listener.positionZ.linearRampToValueAtTime( _position$1.z, endTime );
47285 listener.forwardX.linearRampToValueAtTime( _orientation$1.x, endTime );
47286 listener.forwardY.linearRampToValueAtTime( _orientation$1.y, endTime );
47287 listener.forwardZ.linearRampToValueAtTime( _orientation$1.z, endTime );
47288 listener.upX.linearRampToValueAtTime( up.x, endTime );
47289 listener.upY.linearRampToValueAtTime( up.y, endTime );
47290 listener.upZ.linearRampToValueAtTime( up.z, endTime );
47294 listener.setPosition( _position$1.x, _position$1.y, _position$1.z );
47295 listener.setOrientation( _orientation$1.x, _orientation$1.y, _orientation$1.z, up.x, up.y, up.z );
47303 class Audio extends Object3D {
47305 constructor( listener ) {
47309 this.type = 'Audio';
47311 this.listener = listener;
47312 this.context = listener.context;
47314 this.gain = this.context.createGain();
47315 this.gain.connect( listener.getInput() );
47317 this.autoplay = false;
47319 this.buffer = null;
47322 this.loopStart = 0;
47325 this.duration = undefined;
47326 this.playbackRate = 1;
47327 this.isPlaying = false;
47328 this.hasPlaybackControl = true;
47329 this.source = null;
47330 this.sourceType = 'empty';
47332 this._startedAt = 0;
47333 this._progress = 0;
47334 this._connected = false;
47346 setNodeSource( audioNode ) {
47348 this.hasPlaybackControl = false;
47349 this.sourceType = 'audioNode';
47350 this.source = audioNode;
47357 setMediaElementSource( mediaElement ) {
47359 this.hasPlaybackControl = false;
47360 this.sourceType = 'mediaNode';
47361 this.source = this.context.createMediaElementSource( mediaElement );
47368 setMediaStreamSource( mediaStream ) {
47370 this.hasPlaybackControl = false;
47371 this.sourceType = 'mediaStreamNode';
47372 this.source = this.context.createMediaStreamSource( mediaStream );
47379 setBuffer( audioBuffer ) {
47381 this.buffer = audioBuffer;
47382 this.sourceType = 'buffer';
47384 if ( this.autoplay ) this.play();
47390 play( delay = 0 ) {
47392 if ( this.isPlaying === true ) {
47394 console.warn( 'THREE.Audio: Audio is already playing.' );
47399 if ( this.hasPlaybackControl === false ) {
47401 console.warn( 'THREE.Audio: this Audio has no playback control.' );
47406 this._startedAt = this.context.currentTime + delay;
47408 const source = this.context.createBufferSource();
47409 source.buffer = this.buffer;
47410 source.loop = this.loop;
47411 source.loopStart = this.loopStart;
47412 source.loopEnd = this.loopEnd;
47413 source.onended = this.onEnded.bind( this );
47414 source.start( this._startedAt, this._progress + this.offset, this.duration );
47416 this.isPlaying = true;
47418 this.source = source;
47420 this.setDetune( this.detune );
47421 this.setPlaybackRate( this.playbackRate );
47423 return this.connect();
47429 if ( this.hasPlaybackControl === false ) {
47431 console.warn( 'THREE.Audio: this Audio has no playback control.' );
47436 if ( this.isPlaying === true ) {
47438 // update current progress
47440 this._progress += Math.max( this.context.currentTime - this._startedAt, 0 ) * this.playbackRate;
47442 if ( this.loop === true ) {
47444 // ensure _progress does not exceed duration with looped audios
47446 this._progress = this._progress % ( this.duration || this.buffer.duration );
47450 this.source.stop();
47451 this.source.onended = null;
47453 this.isPlaying = false;
47463 if ( this.hasPlaybackControl === false ) {
47465 console.warn( 'THREE.Audio: this Audio has no playback control.' );
47470 this._progress = 0;
47472 if ( this.source !== null ) {
47474 this.source.stop();
47475 this.source.onended = null;
47479 this.isPlaying = false;
47487 if ( this.filters.length > 0 ) {
47489 this.source.connect( this.filters[ 0 ] );
47491 for ( let i = 1, l = this.filters.length; i < l; i ++ ) {
47493 this.filters[ i - 1 ].connect( this.filters[ i ] );
47497 this.filters[ this.filters.length - 1 ].connect( this.getOutput() );
47501 this.source.connect( this.getOutput() );
47505 this._connected = true;
47513 if ( this._connected === false ) {
47519 if ( this.filters.length > 0 ) {
47521 this.source.disconnect( this.filters[ 0 ] );
47523 for ( let i = 1, l = this.filters.length; i < l; i ++ ) {
47525 this.filters[ i - 1 ].disconnect( this.filters[ i ] );
47529 this.filters[ this.filters.length - 1 ].disconnect( this.getOutput() );
47533 this.source.disconnect( this.getOutput() );
47537 this._connected = false;
47545 return this.filters;
47549 setFilters( value ) {
47551 if ( ! value ) value = [];
47553 if ( this._connected === true ) {
47556 this.filters = value.slice();
47561 this.filters = value.slice();
47569 setDetune( value ) {
47571 this.detune = value;
47573 if ( this.source.detune === undefined ) return; // only set detune when available
47575 if ( this.isPlaying === true ) {
47577 this.source.detune.setTargetAtTime( this.detune, this.context.currentTime, 0.01 );
47587 return this.detune;
47593 return this.getFilters()[ 0 ];
47597 setFilter( filter ) {
47599 return this.setFilters( filter ? [ filter ] : [] );
47603 setPlaybackRate( value ) {
47605 if ( this.hasPlaybackControl === false ) {
47607 console.warn( 'THREE.Audio: this Audio has no playback control.' );
47612 this.playbackRate = value;
47614 if ( this.isPlaying === true ) {
47616 this.source.playbackRate.setTargetAtTime( this.playbackRate, this.context.currentTime, 0.01 );
47624 getPlaybackRate() {
47626 return this.playbackRate;
47632 this.isPlaying = false;
47638 if ( this.hasPlaybackControl === false ) {
47640 console.warn( 'THREE.Audio: this Audio has no playback control.' );
47651 if ( this.hasPlaybackControl === false ) {
47653 console.warn( 'THREE.Audio: this Audio has no playback control.' );
47660 if ( this.isPlaying === true ) {
47662 this.source.loop = this.loop;
47670 setLoopStart( value ) {
47672 this.loopStart = value;
47678 setLoopEnd( value ) {
47680 this.loopEnd = value;
47688 return this.gain.gain.value;
47692 setVolume( value ) {
47694 this.gain.gain.setTargetAtTime( value, this.context.currentTime, 0.01 );
47702 const _position = /*@__PURE__*/ new Vector3();
47703 const _quaternion = /*@__PURE__*/ new Quaternion();
47704 const _scale = /*@__PURE__*/ new Vector3();
47705 const _orientation = /*@__PURE__*/ new Vector3();
47707 class PositionalAudio extends Audio {
47709 constructor( listener ) {
47713 this.panner = this.context.createPanner();
47714 this.panner.panningModel = 'HRTF';
47715 this.panner.connect( this.gain );
47723 this.panner.connect( this.gain );
47729 super.disconnect();
47731 this.panner.disconnect( this.gain );
47737 return this.panner;
47743 return this.panner.refDistance;
47747 setRefDistance( value ) {
47749 this.panner.refDistance = value;
47755 getRolloffFactor() {
47757 return this.panner.rolloffFactor;
47761 setRolloffFactor( value ) {
47763 this.panner.rolloffFactor = value;
47769 getDistanceModel() {
47771 return this.panner.distanceModel;
47775 setDistanceModel( value ) {
47777 this.panner.distanceModel = value;
47785 return this.panner.maxDistance;
47789 setMaxDistance( value ) {
47791 this.panner.maxDistance = value;
47797 setDirectionalCone( coneInnerAngle, coneOuterAngle, coneOuterGain ) {
47799 this.panner.coneInnerAngle = coneInnerAngle;
47800 this.panner.coneOuterAngle = coneOuterAngle;
47801 this.panner.coneOuterGain = coneOuterGain;
47807 updateMatrixWorld( force ) {
47809 super.updateMatrixWorld( force );
47811 if ( this.hasPlaybackControl === true && this.isPlaying === false ) return;
47813 this.matrixWorld.decompose( _position, _quaternion, _scale );
47815 _orientation.set( 0, 0, 1 ).applyQuaternion( _quaternion );
47817 const panner = this.panner;
47819 if ( panner.positionX ) {
47821 // code path for Chrome and Firefox (see #14393)
47823 const endTime = this.context.currentTime + this.listener.timeDelta;
47825 panner.positionX.linearRampToValueAtTime( _position.x, endTime );
47826 panner.positionY.linearRampToValueAtTime( _position.y, endTime );
47827 panner.positionZ.linearRampToValueAtTime( _position.z, endTime );
47828 panner.orientationX.linearRampToValueAtTime( _orientation.x, endTime );
47829 panner.orientationY.linearRampToValueAtTime( _orientation.y, endTime );
47830 panner.orientationZ.linearRampToValueAtTime( _orientation.z, endTime );
47834 panner.setPosition( _position.x, _position.y, _position.z );
47835 panner.setOrientation( _orientation.x, _orientation.y, _orientation.z );
47843 class AudioAnalyser {
47845 constructor( audio, fftSize = 2048 ) {
47847 this.analyser = audio.context.createAnalyser();
47848 this.analyser.fftSize = fftSize;
47850 this.data = new Uint8Array( this.analyser.frequencyBinCount );
47852 audio.getOutput().connect( this.analyser );
47857 getFrequencyData() {
47859 this.analyser.getByteFrequencyData( this.data );
47865 getAverageFrequency() {
47868 const data = this.getFrequencyData();
47870 for ( let i = 0; i < data.length; i ++ ) {
47872 value += data[ i ];
47876 return value / data.length;
47882 class PropertyMixer {
47884 constructor( binding, typeName, valueSize ) {
47886 this.binding = binding;
47887 this.valueSize = valueSize;
47890 mixFunctionAdditive,
47893 // buffer layout: [ incoming | accu0 | accu1 | orig | addAccu | (optional work) ]
47895 // interpolators can use .buffer as their .result
47896 // the data then goes to 'incoming'
47898 // 'accu0' and 'accu1' are used frame-interleaved for
47899 // the cumulative result and are compared to detect
47902 // 'orig' stores the original state of the property
47904 // 'add' is used for additive cumulative results
47906 // 'work' is optional and is only present for quaternion types. It is used
47907 // to store intermediate quaternion multiplication results
47909 switch ( typeName ) {
47912 mixFunction = this._slerp;
47913 mixFunctionAdditive = this._slerpAdditive;
47914 setIdentity = this._setAdditiveIdentityQuaternion;
47916 this.buffer = new Float64Array( valueSize * 6 );
47917 this._workIndex = 5;
47922 mixFunction = this._select;
47924 // Use the regular mix function and for additive on these types,
47925 // additive is not relevant for non-numeric types
47926 mixFunctionAdditive = this._select;
47928 setIdentity = this._setAdditiveIdentityOther;
47930 this.buffer = new Array( valueSize * 5 );
47934 mixFunction = this._lerp;
47935 mixFunctionAdditive = this._lerpAdditive;
47936 setIdentity = this._setAdditiveIdentityNumeric;
47938 this.buffer = new Float64Array( valueSize * 5 );
47942 this._mixBufferRegion = mixFunction;
47943 this._mixBufferRegionAdditive = mixFunctionAdditive;
47944 this._setIdentity = setIdentity;
47945 this._origIndex = 3;
47946 this._addIndex = 4;
47948 this.cumulativeWeight = 0;
47949 this.cumulativeWeightAdditive = 0;
47952 this.referenceCount = 0;
47956 // accumulate data in the 'incoming' region into 'accu<i>'
47957 accumulate( accuIndex, weight ) {
47959 // note: happily accumulating nothing when weight = 0, the caller knows
47960 // the weight and shouldn't have made the call in the first place
47962 const buffer = this.buffer,
47963 stride = this.valueSize,
47964 offset = accuIndex * stride + stride;
47966 let currentWeight = this.cumulativeWeight;
47968 if ( currentWeight === 0 ) {
47970 // accuN := incoming * weight
47972 for ( let i = 0; i !== stride; ++ i ) {
47974 buffer[ offset + i ] = buffer[ i ];
47978 currentWeight = weight;
47982 // accuN := accuN + incoming * weight
47984 currentWeight += weight;
47985 const mix = weight / currentWeight;
47986 this._mixBufferRegion( buffer, offset, 0, mix, stride );
47990 this.cumulativeWeight = currentWeight;
47994 // accumulate data in the 'incoming' region into 'add'
47995 accumulateAdditive( weight ) {
47997 const buffer = this.buffer,
47998 stride = this.valueSize,
47999 offset = stride * this._addIndex;
48001 if ( this.cumulativeWeightAdditive === 0 ) {
48005 this._setIdentity();
48009 // add := add + incoming * weight
48011 this._mixBufferRegionAdditive( buffer, offset, 0, weight, stride );
48012 this.cumulativeWeightAdditive += weight;
48016 // apply the state of 'accu<i>' to the binding when accus differ
48017 apply( accuIndex ) {
48019 const stride = this.valueSize,
48020 buffer = this.buffer,
48021 offset = accuIndex * stride + stride,
48023 weight = this.cumulativeWeight,
48024 weightAdditive = this.cumulativeWeightAdditive,
48026 binding = this.binding;
48028 this.cumulativeWeight = 0;
48029 this.cumulativeWeightAdditive = 0;
48031 if ( weight < 1 ) {
48033 // accuN := accuN + original * ( 1 - cumulativeWeight )
48035 const originalValueOffset = stride * this._origIndex;
48037 this._mixBufferRegion(
48038 buffer, offset, originalValueOffset, 1 - weight, stride );
48042 if ( weightAdditive > 0 ) {
48044 // accuN := accuN + additive accuN
48046 this._mixBufferRegionAdditive( buffer, offset, this._addIndex * stride, 1, stride );
48050 for ( let i = stride, e = stride + stride; i !== e; ++ i ) {
48052 if ( buffer[ i ] !== buffer[ i + stride ] ) {
48054 // value has changed -> update scene graph
48056 binding.setValue( buffer, offset );
48065 // remember the state of the bound property and copy it to both accus
48066 saveOriginalState() {
48068 const binding = this.binding;
48070 const buffer = this.buffer,
48071 stride = this.valueSize,
48073 originalValueOffset = stride * this._origIndex;
48075 binding.getValue( buffer, originalValueOffset );
48077 // accu[0..1] := orig -- initially detect changes against the original
48078 for ( let i = stride, e = originalValueOffset; i !== e; ++ i ) {
48080 buffer[ i ] = buffer[ originalValueOffset + ( i % stride ) ];
48084 // Add to identity for additive
48085 this._setIdentity();
48087 this.cumulativeWeight = 0;
48088 this.cumulativeWeightAdditive = 0;
48092 // apply the state previously taken via 'saveOriginalState' to the binding
48093 restoreOriginalState() {
48095 const originalValueOffset = this.valueSize * 3;
48096 this.binding.setValue( this.buffer, originalValueOffset );
48100 _setAdditiveIdentityNumeric() {
48102 const startIndex = this._addIndex * this.valueSize;
48103 const endIndex = startIndex + this.valueSize;
48105 for ( let i = startIndex; i < endIndex; i ++ ) {
48107 this.buffer[ i ] = 0;
48113 _setAdditiveIdentityQuaternion() {
48115 this._setAdditiveIdentityNumeric();
48116 this.buffer[ this._addIndex * this.valueSize + 3 ] = 1;
48120 _setAdditiveIdentityOther() {
48122 const startIndex = this._origIndex * this.valueSize;
48123 const targetIndex = this._addIndex * this.valueSize;
48125 for ( let i = 0; i < this.valueSize; i ++ ) {
48127 this.buffer[ targetIndex + i ] = this.buffer[ startIndex + i ];
48136 _select( buffer, dstOffset, srcOffset, t, stride ) {
48140 for ( let i = 0; i !== stride; ++ i ) {
48142 buffer[ dstOffset + i ] = buffer[ srcOffset + i ];
48150 _slerp( buffer, dstOffset, srcOffset, t ) {
48152 Quaternion.slerpFlat( buffer, dstOffset, buffer, dstOffset, buffer, srcOffset, t );
48156 _slerpAdditive( buffer, dstOffset, srcOffset, t, stride ) {
48158 const workOffset = this._workIndex * stride;
48160 // Store result in intermediate buffer offset
48161 Quaternion.multiplyQuaternionsFlat( buffer, workOffset, buffer, dstOffset, buffer, srcOffset );
48163 // Slerp to the intermediate result
48164 Quaternion.slerpFlat( buffer, dstOffset, buffer, dstOffset, buffer, workOffset, t );
48168 _lerp( buffer, dstOffset, srcOffset, t, stride ) {
48172 for ( let i = 0; i !== stride; ++ i ) {
48174 const j = dstOffset + i;
48176 buffer[ j ] = buffer[ j ] * s + buffer[ srcOffset + i ] * t;
48182 _lerpAdditive( buffer, dstOffset, srcOffset, t, stride ) {
48184 for ( let i = 0; i !== stride; ++ i ) {
48186 const j = dstOffset + i;
48188 buffer[ j ] = buffer[ j ] + buffer[ srcOffset + i ] * t;
48196 // Characters [].:/ are reserved for track binding syntax.
48197 const _RESERVED_CHARS_RE = '\\[\\]\\.:\\/';
48198 const _reservedRe = new RegExp( '[' + _RESERVED_CHARS_RE + ']', 'g' );
48200 // Attempts to allow node names from any language. ES5's `\w` regexp matches
48201 // only latin characters, and the unicode \p{L} is not yet supported. So
48202 // instead, we exclude reserved characters and match everything else.
48203 const _wordChar = '[^' + _RESERVED_CHARS_RE + ']';
48204 const _wordCharOrDot = '[^' + _RESERVED_CHARS_RE.replace( '\\.', '' ) + ']';
48206 // Parent directories, delimited by '/' or ':'. Currently unused, but must
48207 // be matched to parse the rest of the track name.
48208 const _directoryRe = /*@__PURE__*/ /((?:WC+[\/:])*)/.source.replace( 'WC', _wordChar );
48210 // Target node. May contain word characters (a-zA-Z0-9_) and '.' or '-'.
48211 const _nodeRe = /*@__PURE__*/ /(WCOD+)?/.source.replace( 'WCOD', _wordCharOrDot );
48213 // Object on target node, and accessor. May not contain reserved
48214 // characters. Accessor may contain any character except closing bracket.
48215 const _objectRe = /*@__PURE__*/ /(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace( 'WC', _wordChar );
48217 // Property and accessor. May not contain reserved characters. Accessor may
48218 // contain any non-bracket characters.
48219 const _propertyRe = /*@__PURE__*/ /\.(WC+)(?:\[(.+)\])?/.source.replace( 'WC', _wordChar );
48221 const _trackRe = new RegExp( ''
48230 const _supportedObjectNames = [ 'material', 'materials', 'bones', 'map' ];
48234 constructor( targetGroup, path, optionalParsedPath ) {
48236 const parsedPath = optionalParsedPath || PropertyBinding.parseTrackName( path );
48238 this._targetGroup = targetGroup;
48239 this._bindings = targetGroup.subscribe_( path, parsedPath );
48243 getValue( array, offset ) {
48245 this.bind(); // bind all binding
48247 const firstValidIndex = this._targetGroup.nCachedObjects_,
48248 binding = this._bindings[ firstValidIndex ];
48250 // and only call .getValue on the first
48251 if ( binding !== undefined ) binding.getValue( array, offset );
48255 setValue( array, offset ) {
48257 const bindings = this._bindings;
48259 for ( let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++ i ) {
48261 bindings[ i ].setValue( array, offset );
48269 const bindings = this._bindings;
48271 for ( let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++ i ) {
48273 bindings[ i ].bind();
48281 const bindings = this._bindings;
48283 for ( let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++ i ) {
48285 bindings[ i ].unbind();
48293 // Note: This class uses a State pattern on a per-method basis:
48294 // 'bind' sets 'this.getValue' / 'setValue' and shadows the
48295 // prototype version of these methods with one that represents
48296 // the bound state. When the property is not found, the methods
48298 class PropertyBinding {
48300 constructor( rootNode, path, parsedPath ) {
48303 this.parsedPath = parsedPath || PropertyBinding.parseTrackName( path );
48305 this.node = PropertyBinding.findNode( rootNode, this.parsedPath.nodeName );
48307 this.rootNode = rootNode;
48309 // initial state of these methods that calls 'bind'
48310 this.getValue = this._getValue_unbound;
48311 this.setValue = this._setValue_unbound;
48316 static create( root, path, parsedPath ) {
48318 if ( ! ( root && root.isAnimationObjectGroup ) ) {
48320 return new PropertyBinding( root, path, parsedPath );
48324 return new PropertyBinding.Composite( root, path, parsedPath );
48337 static sanitizeNodeName( name ) {
48339 return name.replace( /\s/g, '_' ).replace( _reservedRe, '' );
48343 static parseTrackName( trackName ) {
48345 const matches = _trackRe.exec( trackName );
48347 if ( matches === null ) {
48349 throw new Error( 'PropertyBinding: Cannot parse trackName: ' + trackName );
48354 // directoryName: matches[ 1 ], // (tschw) currently unused
48355 nodeName: matches[ 2 ],
48356 objectName: matches[ 3 ],
48357 objectIndex: matches[ 4 ],
48358 propertyName: matches[ 5 ], // required
48359 propertyIndex: matches[ 6 ]
48362 const lastDot = results.nodeName && results.nodeName.lastIndexOf( '.' );
48364 if ( lastDot !== undefined && lastDot !== - 1 ) {
48366 const objectName = results.nodeName.substring( lastDot + 1 );
48368 // Object names must be checked against an allowlist. Otherwise, there
48369 // is no way to parse 'foo.bar.baz': 'baz' must be a property, but
48370 // 'bar' could be the objectName, or part of a nodeName (which can
48371 // include '.' characters).
48372 if ( _supportedObjectNames.indexOf( objectName ) !== - 1 ) {
48374 results.nodeName = results.nodeName.substring( 0, lastDot );
48375 results.objectName = objectName;
48381 if ( results.propertyName === null || results.propertyName.length === 0 ) {
48383 throw new Error( 'PropertyBinding: can not parse propertyName from trackName: ' + trackName );
48391 static findNode( root, nodeName ) {
48393 if ( nodeName === undefined || nodeName === '' || nodeName === '.' || nodeName === - 1 || nodeName === root.name || nodeName === root.uuid ) {
48399 // search into skeleton bones.
48400 if ( root.skeleton ) {
48402 const bone = root.skeleton.getBoneByName( nodeName );
48404 if ( bone !== undefined ) {
48412 // search into node subtree.
48413 if ( root.children ) {
48415 const searchNodeSubtree = function ( children ) {
48417 for ( let i = 0; i < children.length; i ++ ) {
48419 const childNode = children[ i ];
48421 if ( childNode.name === nodeName || childNode.uuid === nodeName ) {
48427 const result = searchNodeSubtree( childNode.children );
48429 if ( result ) return result;
48437 const subTreeNode = searchNodeSubtree( root.children );
48439 if ( subTreeNode ) {
48441 return subTreeNode;
48451 // these are used to "
bind" a nonexistent property
48452 _getValue_unavailable() {}
48453 _setValue_unavailable() {}
48457 _getValue_direct( buffer, offset ) {
48459 buffer[ offset ] = this.targetObject[ this.propertyName ];
48463 _getValue_array( buffer, offset ) {
48465 const source = this.resolvedProperty;
48467 for ( let i = 0, n = source.length; i !== n; ++ i ) {
48469 buffer[ offset ++ ] = source[ i ];
48475 _getValue_arrayElement( buffer, offset ) {
48477 buffer[ offset ] = this.resolvedProperty[ this.propertyIndex ];
48481 _getValue_toArray( buffer, offset ) {
48483 this.resolvedProperty.toArray( buffer, offset );
48489 _setValue_direct( buffer, offset ) {
48491 this.targetObject[ this.propertyName ] = buffer[ offset ];
48495 _setValue_direct_setNeedsUpdate( buffer, offset ) {
48497 this.targetObject[ this.propertyName ] = buffer[ offset ];
48498 this.targetObject.needsUpdate = true;
48502 _setValue_direct_setMatrixWorldNeedsUpdate( buffer, offset ) {
48504 this.targetObject[ this.propertyName ] = buffer[ offset ];
48505 this.targetObject.matrixWorldNeedsUpdate = true;
48511 _setValue_array( buffer, offset ) {
48513 const dest = this.resolvedProperty;
48515 for ( let i = 0, n = dest.length; i !== n; ++ i ) {
48517 dest[ i ] = buffer[ offset ++ ];
48523 _setValue_array_setNeedsUpdate( buffer, offset ) {
48525 const dest = this.resolvedProperty;
48527 for ( let i = 0, n = dest.length; i !== n; ++ i ) {
48529 dest[ i ] = buffer[ offset ++ ];
48533 this.targetObject.needsUpdate = true;
48537 _setValue_array_setMatrixWorldNeedsUpdate( buffer, offset ) {
48539 const dest = this.resolvedProperty;
48541 for ( let i = 0, n = dest.length; i !== n; ++ i ) {
48543 dest[ i ] = buffer[ offset ++ ];
48547 this.targetObject.matrixWorldNeedsUpdate = true;
48553 _setValue_arrayElement( buffer, offset ) {
48555 this.resolvedProperty[ this.propertyIndex ] = buffer[ offset ];
48559 _setValue_arrayElement_setNeedsUpdate( buffer, offset ) {
48561 this.resolvedProperty[ this.propertyIndex ] = buffer[ offset ];
48562 this.targetObject.needsUpdate = true;
48566 _setValue_arrayElement_setMatrixWorldNeedsUpdate( buffer, offset ) {
48568 this.resolvedProperty[ this.propertyIndex ] = buffer[ offset ];
48569 this.targetObject.matrixWorldNeedsUpdate = true;
48575 _setValue_fromArray( buffer, offset ) {
48577 this.resolvedProperty.fromArray( buffer, offset );
48581 _setValue_fromArray_setNeedsUpdate( buffer, offset ) {
48583 this.resolvedProperty.fromArray( buffer, offset );
48584 this.targetObject.needsUpdate = true;
48588 _setValue_fromArray_setMatrixWorldNeedsUpdate( buffer, offset ) {
48590 this.resolvedProperty.fromArray( buffer, offset );
48591 this.targetObject.matrixWorldNeedsUpdate = true;
48595 _getValue_unbound( targetArray, offset ) {
48598 this.getValue( targetArray, offset );
48602 _setValue_unbound( sourceArray, offset ) {
48605 this.setValue( sourceArray, offset );
48609 // create getter / setter pair for a property in the scene graph
48612 let targetObject = this.node;
48613 const parsedPath = this.parsedPath;
48615 const objectName = parsedPath.objectName;
48616 const propertyName = parsedPath.propertyName;
48617 let propertyIndex = parsedPath.propertyIndex;
48619 if ( ! targetObject ) {
48621 targetObject = PropertyBinding.findNode( this.rootNode, parsedPath.nodeName );
48623 this.node = targetObject;
48627 // set fail state so we can just 'return' on error
48628 this.getValue = this._getValue_unavailable;
48629 this.setValue = this._setValue_unavailable;
48631 // ensure there is a value node
48632 if ( ! targetObject ) {
48634 console.warn( 'THREE.PropertyBinding: No target node found for track: ' + this.path + '.' );
48639 if ( objectName ) {
48641 let objectIndex = parsedPath.objectIndex;
48643 // special cases were we need to reach deeper into the hierarchy to get the face materials....
48644 switch ( objectName ) {
48648 if ( ! targetObject.material ) {
48650 console.error( 'THREE.PropertyBinding: Can not bind to material as node does not have a material.', this );
48655 if ( ! targetObject.material.materials ) {
48657 console.error( 'THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.', this );
48662 targetObject = targetObject.material.materials;
48668 if ( ! targetObject.skeleton ) {
48670 console.error( 'THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.', this );
48675 // potential future optimization: skip this if propertyIndex is already an integer
48676 // and convert the integer string to a true integer.
48678 targetObject = targetObject.skeleton.bones;
48680 // support resolving morphTarget names into indices.
48681 for ( let i = 0; i < targetObject.length; i ++ ) {
48683 if ( targetObject[ i ].name === objectIndex ) {
48696 if ( 'map' in targetObject ) {
48698 targetObject = targetObject.map;
48703 if ( ! targetObject.material ) {
48705 console.error( 'THREE.PropertyBinding: Can not bind to material as node does not have a material.', this );
48710 if ( ! targetObject.material.map ) {
48712 console.error( 'THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.', this );
48717 targetObject = targetObject.material.map;
48722 if ( targetObject[ objectName ] === undefined ) {
48724 console.error( 'THREE.PropertyBinding: Can not bind to objectName of node undefined.', this );
48729 targetObject = targetObject[ objectName ];
48734 if ( objectIndex !== undefined ) {
48736 if ( targetObject[ objectIndex ] === undefined ) {
48738 console.error( 'THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.', this, targetObject );
48743 targetObject = targetObject[ objectIndex ];
48749 // resolve property
48750 const nodeProperty = targetObject[ propertyName ];
48752 if ( nodeProperty === undefined ) {
48754 const nodeName = parsedPath.nodeName;
48756 console.error( 'THREE.PropertyBinding: Trying to update property for track: ' + nodeName +
48757 '.' + propertyName + ' but it wasn\'t found.', targetObject );
48762 // determine versioning scheme
48763 let versioning = this.Versioning.None;
48765 this.targetObject = targetObject;
48767 if ( targetObject.needsUpdate !== undefined ) { // material
48769 versioning = this.Versioning.NeedsUpdate;
48771 } else if ( targetObject.matrixWorldNeedsUpdate !== undefined ) { // node transform
48773 versioning = this.Versioning.MatrixWorldNeedsUpdate;
48777 // determine how the property gets bound
48778 let bindingType = this.BindingType.Direct;
48780 if ( propertyIndex !== undefined ) {
48782 // access a sub element of the property array (only primitives are supported right now)
48784 if ( propertyName === 'morphTargetInfluences' ) {
48786 // potential optimization, skip this if propertyIndex is already an integer, and convert the integer string to a true integer.
48788 // support resolving morphTarget names into indices.
48789 if ( ! targetObject.geometry ) {
48791 console.error( 'THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.', this );
48796 if ( ! targetObject.geometry.morphAttributes ) {
48798 console.error( 'THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.', this );
48803 if ( targetObject.morphTargetDictionary[ propertyIndex ] !== undefined ) {
48805 propertyIndex = targetObject.morphTargetDictionary[ propertyIndex ];
48811 bindingType = this.BindingType.ArrayElement;
48813 this.resolvedProperty = nodeProperty;
48814 this.propertyIndex = propertyIndex;
48816 } else if ( nodeProperty.fromArray !== undefined && nodeProperty.toArray !== undefined ) {
48818 // must use copy for Object3D.Euler/Quaternion
48820 bindingType = this.BindingType.HasFromToArray;
48822 this.resolvedProperty = nodeProperty;
48824 } else if ( Array.isArray( nodeProperty ) ) {
48826 bindingType = this.BindingType.EntireArray;
48828 this.resolvedProperty = nodeProperty;
48832 this.propertyName = propertyName;
48836 // select getter / setter
48837 this.getValue = this.GetterByBindingType[ bindingType ];
48838 this.setValue = this.SetterByBindingTypeAndVersioning[ bindingType ][ versioning ];
48846 // back to the prototype version of getValue / setValue
48847 // note: avoiding to mutate the shape of 'this' via 'delete'
48848 this.getValue = this._getValue_unbound;
48849 this.setValue = this._setValue_unbound;
48855 PropertyBinding.Composite = Composite;
48857 PropertyBinding.prototype.BindingType = {
48864 PropertyBinding.prototype.Versioning = {
48867 MatrixWorldNeedsUpdate: 2
48870 PropertyBinding.prototype.GetterByBindingType = [
48872 PropertyBinding.prototype._getValue_direct,
48873 PropertyBinding.prototype._getValue_array,
48874 PropertyBinding.prototype._getValue_arrayElement,
48875 PropertyBinding.prototype._getValue_toArray,
48879 PropertyBinding.prototype.SetterByBindingTypeAndVersioning = [
48883 PropertyBinding.prototype._setValue_direct,
48884 PropertyBinding.prototype._setValue_direct_setNeedsUpdate,
48885 PropertyBinding.prototype._setValue_direct_setMatrixWorldNeedsUpdate,
48891 PropertyBinding.prototype._setValue_array,
48892 PropertyBinding.prototype._setValue_array_setNeedsUpdate,
48893 PropertyBinding.prototype._setValue_array_setMatrixWorldNeedsUpdate,
48898 PropertyBinding.prototype._setValue_arrayElement,
48899 PropertyBinding.prototype._setValue_arrayElement_setNeedsUpdate,
48900 PropertyBinding.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate,
48905 PropertyBinding.prototype._setValue_fromArray,
48906 PropertyBinding.prototype._setValue_fromArray_setNeedsUpdate,
48907 PropertyBinding.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate,
48942 class AnimationObjectGroup {
48946 this.isAnimationObjectGroup = true;
48948 this.uuid = generateUUID();
48950 // cached objects followed by the active ones
48951 this._objects = Array.prototype.slice.call( arguments );
48953 this.nCachedObjects_ = 0; // threshold
48954 // note: read by PropertyBinding.Composite
48956 const indices = {};
48957 this._indicesByUUID = indices; // for bookkeeping
48959 for ( let i = 0, n = arguments.length; i !== n; ++ i ) {
48961 indices[ arguments[ i ].uuid ] = i;
48965 this._paths = []; // inside: string
48966 this._parsedPaths = []; // inside: { we don't care, here }
48967 this._bindings = []; // inside: Array< PropertyBinding >
48968 this._bindingsIndicesByPath = {}; // inside: indices in these arrays
48970 const scope = this;
48977 return scope._objects.length;
48982 return this.total - scope.nCachedObjects_;
48986 get bindingsPerObject() {
48988 return scope._bindings.length;
48998 const objects = this._objects,
48999 indicesByUUID = this._indicesByUUID,
49000 paths = this._paths,
49001 parsedPaths = this._parsedPaths,
49002 bindings = this._bindings,
49003 nBindings = bindings.length;
49005 let knownObject = undefined,
49006 nObjects = objects.length,
49007 nCachedObjects = this.nCachedObjects_;
49009 for ( let i = 0, n = arguments.length; i !== n; ++ i ) {
49011 const object = arguments[ i ],
49012 uuid = object.uuid;
49013 let index = indicesByUUID[ uuid ];
49015 if ( index === undefined ) {
49017 // unknown object -> add it to the ACTIVE region
49019 index = nObjects ++;
49020 indicesByUUID[ uuid ] = index;
49021 objects.push( object );
49023 // accounting is done, now do the same for all bindings
49025 for ( let j = 0, m = nBindings; j !== m; ++ j ) {
49027 bindings[ j ].push( new PropertyBinding( object, paths[ j ], parsedPaths[ j ] ) );
49031 } else if ( index < nCachedObjects ) {
49033 knownObject = objects[ index ];
49035 // move existing object to the ACTIVE region
49037 const firstActiveIndex = -- nCachedObjects,
49038 lastCachedObject = objects[ firstActiveIndex ];
49040 indicesByUUID[ lastCachedObject.uuid ] = index;
49041 objects[ index ] = lastCachedObject;
49043 indicesByUUID[ uuid ] = firstActiveIndex;
49044 objects[ firstActiveIndex ] = object;
49046 // accounting is done, now do the same for all bindings
49048 for ( let j = 0, m = nBindings; j !== m; ++ j ) {
49050 const bindingsForPath = bindings[ j ],
49051 lastCached = bindingsForPath[ firstActiveIndex ];
49053 let binding = bindingsForPath[ index ];
49055 bindingsForPath[ index ] = lastCached;
49057 if ( binding === undefined ) {
49059 // since we do not bother to create new bindings
49060 // for objects that are cached, the binding may
49061 // or may not exist
49063 binding = new PropertyBinding( object, paths[ j ], parsedPaths[ j ] );
49067 bindingsForPath[ firstActiveIndex ] = binding;
49071 } else if ( objects[ index ] !== knownObject ) {
49073 console.error( 'THREE.AnimationObjectGroup: Different objects with the same UUID ' +
49074 'detected. Clean the caches or recreate your infrastructure when reloading scenes.' );
49076 } // else the object is already where we want it to be
49080 this.nCachedObjects_ = nCachedObjects;
49086 const objects = this._objects,
49087 indicesByUUID = this._indicesByUUID,
49088 bindings = this._bindings,
49089 nBindings = bindings.length;
49091 let nCachedObjects = this.nCachedObjects_;
49093 for ( let i = 0, n = arguments.length; i !== n; ++ i ) {
49095 const object = arguments[ i ],
49096 uuid = object.uuid,
49097 index = indicesByUUID[ uuid ];
49099 if ( index !== undefined && index >= nCachedObjects ) {
49101 // move existing object into the CACHED region
49103 const lastCachedIndex = nCachedObjects ++,
49104 firstActiveObject = objects[ lastCachedIndex ];
49106 indicesByUUID[ firstActiveObject.uuid ] = index;
49107 objects[ index ] = firstActiveObject;
49109 indicesByUUID[ uuid ] = lastCachedIndex;
49110 objects[ lastCachedIndex ] = object;
49112 // accounting is done, now do the same for all bindings
49114 for ( let j = 0, m = nBindings; j !== m; ++ j ) {
49116 const bindingsForPath = bindings[ j ],
49117 firstActive = bindingsForPath[ lastCachedIndex ],
49118 binding = bindingsForPath[ index ];
49120 bindingsForPath[ index ] = firstActive;
49121 bindingsForPath[ lastCachedIndex ] = binding;
49129 this.nCachedObjects_ = nCachedObjects;
49136 const objects = this._objects,
49137 indicesByUUID = this._indicesByUUID,
49138 bindings = this._bindings,
49139 nBindings = bindings.length;
49141 let nCachedObjects = this.nCachedObjects_,
49142 nObjects = objects.length;
49144 for ( let i = 0, n = arguments.length; i !== n; ++ i ) {
49146 const object = arguments[ i ],
49147 uuid = object.uuid,
49148 index = indicesByUUID[ uuid ];
49150 if ( index !== undefined ) {
49152 delete indicesByUUID[ uuid ];
49154 if ( index < nCachedObjects ) {
49156 // object is cached, shrink the CACHED region
49158 const firstActiveIndex = -- nCachedObjects,
49159 lastCachedObject = objects[ firstActiveIndex ],
49160 lastIndex = -- nObjects,
49161 lastObject = objects[ lastIndex ];
49163 // last cached object takes this object's place
49164 indicesByUUID[ lastCachedObject.uuid ] = index;
49165 objects[ index ] = lastCachedObject;
49167 // last object goes to the activated slot and pop
49168 indicesByUUID[ lastObject.uuid ] = firstActiveIndex;
49169 objects[ firstActiveIndex ] = lastObject;
49172 // accounting is done, now do the same for all bindings
49174 for ( let j = 0, m = nBindings; j !== m; ++ j ) {
49176 const bindingsForPath = bindings[ j ],
49177 lastCached = bindingsForPath[ firstActiveIndex ],
49178 last = bindingsForPath[ lastIndex ];
49180 bindingsForPath[ index ] = lastCached;
49181 bindingsForPath[ firstActiveIndex ] = last;
49182 bindingsForPath.pop();
49188 // object is active, just swap with the last and pop
49190 const lastIndex = -- nObjects,
49191 lastObject = objects[ lastIndex ];
49193 if ( lastIndex > 0 ) {
49195 indicesByUUID[ lastObject.uuid ] = index;
49199 objects[ index ] = lastObject;
49202 // accounting is done, now do the same for all bindings
49204 for ( let j = 0, m = nBindings; j !== m; ++ j ) {
49206 const bindingsForPath = bindings[ j ];
49208 bindingsForPath[ index ] = bindingsForPath[ lastIndex ];
49209 bindingsForPath.pop();
49213 } // cached or active
49215 } // if object is known
49219 this.nCachedObjects_ = nCachedObjects;
49223 // Internal interface used by befriended PropertyBinding.Composite:
49225 subscribe_( path, parsedPath ) {
49227 // returns an array of bindings for the given path that is changed
49228 // according to the contained objects in the group
49230 const indicesByPath = this._bindingsIndicesByPath;
49231 let index = indicesByPath[ path ];
49232 const bindings = this._bindings;
49234 if ( index !== undefined ) return bindings[ index ];
49236 const paths = this._paths,
49237 parsedPaths = this._parsedPaths,
49238 objects = this._objects,
49239 nObjects = objects.length,
49240 nCachedObjects = this.nCachedObjects_,
49241 bindingsForPath = new Array( nObjects );
49243 index = bindings.length;
49245 indicesByPath[ path ] = index;
49247 paths.push( path );
49248 parsedPaths.push( parsedPath );
49249 bindings.push( bindingsForPath );
49251 for ( let i = nCachedObjects, n = objects.length; i !== n; ++ i ) {
49253 const object = objects[ i ];
49254 bindingsForPath[ i ] = new PropertyBinding( object, path, parsedPath );
49258 return bindingsForPath;
49262 unsubscribe_( path ) {
49264 // tells the group to forget about a property path and no longer
49265 // update the array previously obtained with 'subscribe_'
49267 const indicesByPath = this._bindingsIndicesByPath,
49268 index = indicesByPath[ path ];
49270 if ( index !== undefined ) {
49272 const paths = this._paths,
49273 parsedPaths = this._parsedPaths,
49274 bindings = this._bindings,
49275 lastBindingsIndex = bindings.length - 1,
49276 lastBindings = bindings[ lastBindingsIndex ],
49277 lastBindingsPath = path[ lastBindingsIndex ];
49279 indicesByPath[ lastBindingsPath ] = index;
49281 bindings[ index ] = lastBindings;
49284 parsedPaths[ index ] = parsedPaths[ lastBindingsIndex ];
49287 paths[ index ] = paths[ lastBindingsIndex ];
49296 class AnimationAction {
49298 constructor( mixer, clip, localRoot = null, blendMode = clip.blendMode ) {
49300 this._mixer = mixer;
49302 this._localRoot = localRoot;
49303 this.blendMode = blendMode;
49305 const tracks = clip.tracks,
49306 nTracks = tracks.length,
49307 interpolants = new Array( nTracks );
49309 const interpolantSettings = {
49310 endingStart: ZeroCurvatureEnding,
49311 endingEnd: ZeroCurvatureEnding
49314 for ( let i = 0; i !== nTracks; ++ i ) {
49316 const interpolant = tracks[ i ].createInterpolant( null );
49317 interpolants[ i ] = interpolant;
49318 interpolant.settings = interpolantSettings;
49322 this._interpolantSettings = interpolantSettings;
49324 this._interpolants = interpolants; // bound by the mixer
49326 // inside: PropertyMixer (managed by the mixer)
49327 this._propertyBindings = new Array( nTracks );
49329 this._cacheIndex = null; // for the memory manager
49330 this._byClipCacheIndex = null; // for the memory manager
49332 this._timeScaleInterpolant = null;
49333 this._weightInterpolant = null;
49335 this.loop = LoopRepeat;
49336 this._loopCount = - 1;
49338 // global mixer time when the action is to be started
49339 // it's set back to 'null' upon start of the action
49340 this._startTime = null;
49342 // scaled local time of the action
49343 // gets clamped or wrapped to 0..clip.duration according to loop
49346 this.timeScale = 1;
49347 this._effectiveTimeScale = 1;
49350 this._effectiveWeight = 1;
49352 this.repetitions = Infinity; // no. of repetitions when looping
49354 this.paused = false; // true -> zero effective time scale
49355 this.enabled = true; // false -> zero effective weight
49357 this.clampWhenFinished = false;// keep feeding the last frame?
49359 this.zeroSlopeAtStart = true;// for smooth interpolation w/o separate
49360 this.zeroSlopeAtEnd = true;// clips for start, loop and end
49364 // State & Scheduling
49368 this._mixer._activateAction( this );
49376 this._mixer._deactivateAction( this );
49378 return this.reset();
49384 this.paused = false;
49385 this.enabled = true;
49387 this.time = 0; // restart clip
49388 this._loopCount = - 1;// forget previous loops
49389 this._startTime = null;// forget scheduling
49391 return this.stopFading().stopWarping();
49397 return this.enabled && ! this.paused && this.timeScale !== 0 &&
49398 this._startTime === null && this._mixer._isActiveAction( this );
49402 // return true when play has been called
49405 return this._mixer._isActiveAction( this );
49411 this._startTime = time;
49417 setLoop( mode, repetitions ) {
49420 this.repetitions = repetitions;
49428 // set the weight stopping any scheduled fading
49429 // although .enabled = false yields an effective weight of zero, this
49430 // method does *not* change .enabled, because it would be confusing
49431 setEffectiveWeight( weight ) {
49433 this.weight = weight;
49435 // note: same logic as when updated at runtime
49436 this._effectiveWeight = this.enabled ? weight : 0;
49438 return this.stopFading();
49442 // return the weight considering fading and .enabled
49443 getEffectiveWeight() {
49445 return this._effectiveWeight;
49449 fadeIn( duration ) {
49451 return this._scheduleFading( duration, 0, 1 );
49455 fadeOut( duration ) {
49457 return this._scheduleFading( duration, 1, 0 );
49461 crossFadeFrom( fadeOutAction, duration, warp ) {
49463 fadeOutAction.fadeOut( duration );
49464 this.fadeIn( duration );
49468 const fadeInDuration = this._clip.duration,
49469 fadeOutDuration = fadeOutAction._clip.duration,
49471 startEndRatio = fadeOutDuration / fadeInDuration,
49472 endStartRatio = fadeInDuration / fadeOutDuration;
49474 fadeOutAction.warp( 1.0, startEndRatio, duration );
49475 this.warp( endStartRatio, 1.0, duration );
49483 crossFadeTo( fadeInAction, duration, warp ) {
49485 return fadeInAction.crossFadeFrom( this, duration, warp );
49491 const weightInterpolant = this._weightInterpolant;
49493 if ( weightInterpolant !== null ) {
49495 this._weightInterpolant = null;
49496 this._mixer._takeBackControlInterpolant( weightInterpolant );
49504 // Time Scale Control
49506 // set the time scale stopping any scheduled warping
49507 // although .paused = true yields an effective time scale of zero, this
49508 // method does *not* change .paused, because it would be confusing
49509 setEffectiveTimeScale( timeScale ) {
49511 this.timeScale = timeScale;
49512 this._effectiveTimeScale = this.paused ? 0 : timeScale;
49514 return this.stopWarping();
49518 // return the time scale considering warping and .paused
49519 getEffectiveTimeScale() {
49521 return this._effectiveTimeScale;
49525 setDuration( duration ) {
49527 this.timeScale = this._clip.duration / duration;
49529 return this.stopWarping();
49533 syncWith( action ) {
49535 this.time = action.time;
49536 this.timeScale = action.timeScale;
49538 return this.stopWarping();
49544 return this.warp( this._effectiveTimeScale, 0, duration );
49548 warp( startTimeScale, endTimeScale, duration ) {
49550 const mixer = this._mixer,
49552 timeScale = this.timeScale;
49554 let interpolant = this._timeScaleInterpolant;
49556 if ( interpolant === null ) {
49558 interpolant = mixer._lendControlInterpolant();
49559 this._timeScaleInterpolant = interpolant;
49563 const times = interpolant.parameterPositions,
49564 values = interpolant.sampleValues;
49567 times[ 1 ] = now + duration;
49569 values[ 0 ] = startTimeScale / timeScale;
49570 values[ 1 ] = endTimeScale / timeScale;
49578 const timeScaleInterpolant = this._timeScaleInterpolant;
49580 if ( timeScaleInterpolant !== null ) {
49582 this._timeScaleInterpolant = null;
49583 this._mixer._takeBackControlInterpolant( timeScaleInterpolant );
49591 // Object Accessors
49595 return this._mixer;
49607 return this._localRoot || this._mixer._root;
49613 _update( time, deltaTime, timeDirection, accuIndex ) {
49615 // called by the mixer
49617 if ( ! this.enabled ) {
49619 // call ._updateWeight() to update ._effectiveWeight
49621 this._updateWeight( time );
49626 const startTime = this._startTime;
49628 if ( startTime !== null ) {
49630 // check for scheduled start of action
49632 const timeRunning = ( time - startTime ) * timeDirection;
49633 if ( timeRunning < 0 || timeDirection === 0 ) {
49640 this._startTime = null; // unschedule
49641 deltaTime = timeDirection * timeRunning;
49647 // apply time scale and advance time
49649 deltaTime *= this._updateTimeScale( time );
49650 const clipTime = this._updateTime( deltaTime );
49652 // note: _updateTime may disable the action resulting in
49653 // an effective weight of 0
49655 const weight = this._updateWeight( time );
49657 if ( weight > 0 ) {
49659 const interpolants = this._interpolants;
49660 const propertyMixers = this._propertyBindings;
49662 switch ( this.blendMode ) {
49664 case AdditiveAnimationBlendMode:
49666 for ( let j = 0, m = interpolants.length; j !== m; ++ j ) {
49668 interpolants[ j ].evaluate( clipTime );
49669 propertyMixers[ j ].accumulateAdditive( weight );
49675 case NormalAnimationBlendMode:
49678 for ( let j = 0, m = interpolants.length; j !== m; ++ j ) {
49680 interpolants[ j ].evaluate( clipTime );
49681 propertyMixers[ j ].accumulate( accuIndex, weight );
49691 _updateWeight( time ) {
49695 if ( this.enabled ) {
49697 weight = this.weight;
49698 const interpolant = this._weightInterpolant;
49700 if ( interpolant !== null ) {
49702 const interpolantValue = interpolant.evaluate( time )[ 0 ];
49704 weight *= interpolantValue;
49706 if ( time > interpolant.parameterPositions[ 1 ] ) {
49710 if ( interpolantValue === 0 ) {
49712 // faded out, disable
49713 this.enabled = false;
49723 this._effectiveWeight = weight;
49728 _updateTimeScale( time ) {
49732 if ( ! this.paused ) {
49734 timeScale = this.timeScale;
49736 const interpolant = this._timeScaleInterpolant;
49738 if ( interpolant !== null ) {
49740 const interpolantValue = interpolant.evaluate( time )[ 0 ];
49742 timeScale *= interpolantValue;
49744 if ( time > interpolant.parameterPositions[ 1 ] ) {
49746 this.stopWarping();
49748 if ( timeScale === 0 ) {
49750 // motion has halted, pause
49751 this.paused = true;
49755 // warp done - apply final time scale
49756 this.timeScale = timeScale;
49766 this._effectiveTimeScale = timeScale;
49771 _updateTime( deltaTime ) {
49773 const duration = this._clip.duration;
49774 const loop = this.loop;
49776 let time = this.time + deltaTime;
49777 let loopCount = this._loopCount;
49779 const pingPong = ( loop === LoopPingPong );
49781 if ( deltaTime === 0 ) {
49783 if ( loopCount === - 1 ) return time;
49785 return ( pingPong && ( loopCount & 1 ) === 1 ) ? duration - time : time;
49789 if ( loop === LoopOnce ) {
49791 if ( loopCount === - 1 ) {
49795 this._loopCount = 0;
49796 this._setEndings( true, true, false );
49802 if ( time >= duration ) {
49806 } else if ( time < 0 ) {
49818 if ( this.clampWhenFinished ) this.paused = true;
49819 else this.enabled = false;
49823 this._mixer.dispatchEvent( {
49824 type: 'finished', action: this,
49825 direction: deltaTime < 0 ? - 1 : 1
49830 } else { // repetitive Repeat or PingPong
49832 if ( loopCount === - 1 ) {
49836 if ( deltaTime >= 0 ) {
49840 this._setEndings( true, this.repetitions === 0, pingPong );
49844 // when looping in reverse direction, the initial
49845 // transition through zero counts as a repetition,
49846 // so leave loopCount at -1
49848 this._setEndings( this.repetitions === 0, true, pingPong );
49854 if ( time >= duration || time < 0 ) {
49858 const loopDelta = Math.floor( time / duration ); // signed
49859 time -= duration * loopDelta;
49861 loopCount += Math.abs( loopDelta );
49863 const pending = this.repetitions - loopCount;
49865 if ( pending <= 0 ) {
49867 // have to stop (switch state, clamp time, fire event)
49869 if ( this.clampWhenFinished ) this.paused = true;
49870 else this.enabled = false;
49872 time = deltaTime > 0 ? duration : 0;
49876 this._mixer.dispatchEvent( {
49877 type: 'finished', action: this,
49878 direction: deltaTime > 0 ? 1 : - 1
49885 if ( pending === 1 ) {
49887 // entering the last round
49889 const atStart = deltaTime < 0;
49890 this._setEndings( atStart, ! atStart, pingPong );
49894 this._setEndings( false, false, pingPong );
49898 this._loopCount = loopCount;
49902 this._mixer.dispatchEvent( {
49903 type: 'loop', action: this, loopDelta: loopDelta
49914 if ( pingPong && ( loopCount & 1 ) === 1 ) {
49918 return duration - time;
49928 _setEndings( atStart, atEnd, pingPong ) {
49930 const settings = this._interpolantSettings;
49934 settings.endingStart = ZeroSlopeEnding;
49935 settings.endingEnd = ZeroSlopeEnding;
49939 // assuming for LoopOnce atStart == atEnd == true
49943 settings.endingStart = this.zeroSlopeAtStart ? ZeroSlopeEnding : ZeroCurvatureEnding;
49947 settings.endingStart = WrapAroundEnding;
49953 settings.endingEnd = this.zeroSlopeAtEnd ? ZeroSlopeEnding : ZeroCurvatureEnding;
49957 settings.endingEnd = WrapAroundEnding;
49965 _scheduleFading( duration, weightNow, weightThen ) {
49967 const mixer = this._mixer, now = mixer.time;
49968 let interpolant = this._weightInterpolant;
49970 if ( interpolant === null ) {
49972 interpolant = mixer._lendControlInterpolant();
49973 this._weightInterpolant = interpolant;
49977 const times = interpolant.parameterPositions,
49978 values = interpolant.sampleValues;
49981 values[ 0 ] = weightNow;
49982 times[ 1 ] = now + duration;
49983 values[ 1 ] = weightThen;
49991 const _controlInterpolantsResultBuffer = new Float32Array( 1 );
49994 class AnimationMixer extends EventDispatcher {
49996 constructor( root ) {
50001 this._initMemoryManager();
50002 this._accuIndex = 0;
50004 this.timeScale = 1.0;
50008 _bindAction( action, prototypeAction ) {
50010 const root = action._localRoot || this._root,
50011 tracks = action._clip.tracks,
50012 nTracks = tracks.length,
50013 bindings = action._propertyBindings,
50014 interpolants = action._interpolants,
50015 rootUuid = root.uuid,
50016 bindingsByRoot = this._bindingsByRootAndName;
50018 let bindingsByName = bindingsByRoot[ rootUuid ];
50020 if ( bindingsByName === undefined ) {
50022 bindingsByName = {};
50023 bindingsByRoot[ rootUuid ] = bindingsByName;
50027 for ( let i = 0; i !== nTracks; ++ i ) {
50029 const track = tracks[ i ],
50030 trackName = track.name;
50032 let binding = bindingsByName[ trackName ];
50034 if ( binding !== undefined ) {
50036 ++ binding.referenceCount;
50037 bindings[ i ] = binding;
50041 binding = bindings[ i ];
50043 if ( binding !== undefined ) {
50045 // existing binding, make sure the cache knows
50047 if ( binding._cacheIndex === null ) {
50049 ++ binding.referenceCount;
50050 this._addInactiveBinding( binding, rootUuid, trackName );
50058 const path = prototypeAction && prototypeAction.
50059 _propertyBindings[ i ].binding.parsedPath;
50061 binding = new PropertyMixer(
50062 PropertyBinding.create( root, trackName, path ),
50063 track.ValueTypeName, track.getValueSize() );
50065 ++ binding.referenceCount;
50066 this._addInactiveBinding( binding, rootUuid, trackName );
50068 bindings[ i ] = binding;
50072 interpolants[ i ].resultBuffer = binding.buffer;
50078 _activateAction( action ) {
50080 if ( ! this._isActiveAction( action ) ) {
50082 if ( action._cacheIndex === null ) {
50084 // this action has been forgotten by the cache, but the user
50085 // appears to be still using it -> rebind
50087 const rootUuid = ( action._localRoot || this._root ).uuid,
50088 clipUuid = action._clip.uuid,
50089 actionsForClip = this._actionsByClip[ clipUuid ];
50091 this._bindAction( action,
50092 actionsForClip && actionsForClip.knownActions[ 0 ] );
50094 this._addInactiveAction( action, clipUuid, rootUuid );
50098 const bindings = action._propertyBindings;
50100 // increment reference counts / sort out state
50101 for ( let i = 0, n = bindings.length; i !== n; ++ i ) {
50103 const binding = bindings[ i ];
50105 if ( binding.useCount ++ === 0 ) {
50107 this._lendBinding( binding );
50108 binding.saveOriginalState();
50114 this._lendAction( action );
50120 _deactivateAction( action ) {
50122 if ( this._isActiveAction( action ) ) {
50124 const bindings = action._propertyBindings;
50126 // decrement reference counts / sort out state
50127 for ( let i = 0, n = bindings.length; i !== n; ++ i ) {
50129 const binding = bindings[ i ];
50131 if ( -- binding.useCount === 0 ) {
50133 binding.restoreOriginalState();
50134 this._takeBackBinding( binding );
50140 this._takeBackAction( action );
50148 _initMemoryManager() {
50150 this._actions = []; // 'nActiveActions' followed by inactive ones
50151 this._nActiveActions = 0;
50153 this._actionsByClip = {};
50156 // knownActions: Array< AnimationAction > - used as prototypes
50157 // actionByRoot: AnimationAction - lookup
50161 this._bindings = []; // 'nActiveBindings' followed by inactive ones
50162 this._nActiveBindings = 0;
50164 this._bindingsByRootAndName = {}; // inside: Map< name, PropertyMixer >
50167 this._controlInterpolants = []; // same game as above
50168 this._nActiveControlInterpolants = 0;
50170 const scope = this;
50177 return scope._actions.length;
50182 return scope._nActiveActions;
50189 return scope._bindings.length;
50194 return scope._nActiveBindings;
50198 controlInterpolants: {
50201 return scope._controlInterpolants.length;
50206 return scope._nActiveControlInterpolants;
50215 // Memory management for AnimationAction objects
50217 _isActiveAction( action ) {
50219 const index = action._cacheIndex;
50220 return index !== null && index < this._nActiveActions;
50224 _addInactiveAction( action, clipUuid, rootUuid ) {
50226 const actions = this._actions,
50227 actionsByClip = this._actionsByClip;
50229 let actionsForClip = actionsByClip[ clipUuid ];
50231 if ( actionsForClip === undefined ) {
50235 knownActions: [ action ],
50240 action._byClipCacheIndex = 0;
50242 actionsByClip[ clipUuid ] = actionsForClip;
50246 const knownActions = actionsForClip.knownActions;
50248 action._byClipCacheIndex = knownActions.length;
50249 knownActions.push( action );
50253 action._cacheIndex = actions.length;
50254 actions.push( action );
50256 actionsForClip.actionByRoot[ rootUuid ] = action;
50260 _removeInactiveAction( action ) {
50262 const actions = this._actions,
50263 lastInactiveAction = actions[ actions.length - 1 ],
50264 cacheIndex = action._cacheIndex;
50266 lastInactiveAction._cacheIndex = cacheIndex;
50267 actions[ cacheIndex ] = lastInactiveAction;
50270 action._cacheIndex = null;
50273 const clipUuid = action._clip.uuid,
50274 actionsByClip = this._actionsByClip,
50275 actionsForClip = actionsByClip[ clipUuid ],
50276 knownActionsForClip = actionsForClip.knownActions,
50279 knownActionsForClip[ knownActionsForClip.length - 1 ],
50281 byClipCacheIndex = action._byClipCacheIndex;
50283 lastKnownAction._byClipCacheIndex = byClipCacheIndex;
50284 knownActionsForClip[ byClipCacheIndex ] = lastKnownAction;
50285 knownActionsForClip.pop();
50287 action._byClipCacheIndex = null;
50290 const actionByRoot = actionsForClip.actionByRoot,
50291 rootUuid = ( action._localRoot || this._root ).uuid;
50293 delete actionByRoot[ rootUuid ];
50295 if ( knownActionsForClip.length === 0 ) {
50297 delete actionsByClip[ clipUuid ];
50301 this._removeInactiveBindingsForAction( action );
50305 _removeInactiveBindingsForAction( action ) {
50307 const bindings = action._propertyBindings;
50309 for ( let i = 0, n = bindings.length; i !== n; ++ i ) {
50311 const binding = bindings[ i ];
50313 if ( -- binding.referenceCount === 0 ) {
50315 this._removeInactiveBinding( binding );
50323 _lendAction( action ) {
50325 // [ active actions | inactive actions ]
50326 // [ active actions >| inactive actions ]
50331 const actions = this._actions,
50332 prevIndex = action._cacheIndex,
50334 lastActiveIndex = this._nActiveActions ++,
50336 firstInactiveAction = actions[ lastActiveIndex ];
50338 action._cacheIndex = lastActiveIndex;
50339 actions[ lastActiveIndex ] = action;
50341 firstInactiveAction._cacheIndex = prevIndex;
50342 actions[ prevIndex ] = firstInactiveAction;
50346 _takeBackAction( action ) {
50348 // [ active actions | inactive actions ]
50349 // [ active actions |< inactive actions ]
50354 const actions = this._actions,
50355 prevIndex = action._cacheIndex,
50357 firstInactiveIndex = -- this._nActiveActions,
50359 lastActiveAction = actions[ firstInactiveIndex ];
50361 action._cacheIndex = firstInactiveIndex;
50362 actions[ firstInactiveIndex ] = action;
50364 lastActiveAction._cacheIndex = prevIndex;
50365 actions[ prevIndex ] = lastActiveAction;
50369 // Memory management for PropertyMixer objects
50371 _addInactiveBinding( binding, rootUuid, trackName ) {
50373 const bindingsByRoot = this._bindingsByRootAndName,
50374 bindings = this._bindings;
50376 let bindingByName = bindingsByRoot[ rootUuid ];
50378 if ( bindingByName === undefined ) {
50380 bindingByName = {};
50381 bindingsByRoot[ rootUuid ] = bindingByName;
50385 bindingByName[ trackName ] = binding;
50387 binding._cacheIndex = bindings.length;
50388 bindings.push( binding );
50392 _removeInactiveBinding( binding ) {
50394 const bindings = this._bindings,
50395 propBinding = binding.binding,
50396 rootUuid = propBinding.rootNode.uuid,
50397 trackName = propBinding.path,
50398 bindingsByRoot = this._bindingsByRootAndName,
50399 bindingByName = bindingsByRoot[ rootUuid ],
50401 lastInactiveBinding = bindings[ bindings.length - 1 ],
50402 cacheIndex = binding._cacheIndex;
50404 lastInactiveBinding._cacheIndex = cacheIndex;
50405 bindings[ cacheIndex ] = lastInactiveBinding;
50408 delete bindingByName[ trackName ];
50410 if ( Object.keys( bindingByName ).length === 0 ) {
50412 delete bindingsByRoot[ rootUuid ];
50418 _lendBinding( binding ) {
50420 const bindings = this._bindings,
50421 prevIndex = binding._cacheIndex,
50423 lastActiveIndex = this._nActiveBindings ++,
50425 firstInactiveBinding = bindings[ lastActiveIndex ];
50427 binding._cacheIndex = lastActiveIndex;
50428 bindings[ lastActiveIndex ] = binding;
50430 firstInactiveBinding._cacheIndex = prevIndex;
50431 bindings[ prevIndex ] = firstInactiveBinding;
50435 _takeBackBinding( binding ) {
50437 const bindings = this._bindings,
50438 prevIndex = binding._cacheIndex,
50440 firstInactiveIndex = -- this._nActiveBindings,
50442 lastActiveBinding = bindings[ firstInactiveIndex ];
50444 binding._cacheIndex = firstInactiveIndex;
50445 bindings[ firstInactiveIndex ] = binding;
50447 lastActiveBinding._cacheIndex = prevIndex;
50448 bindings[ prevIndex ] = lastActiveBinding;
50453 // Memory management of Interpolants for weight and time scale
50455 _lendControlInterpolant() {
50457 const interpolants = this._controlInterpolants,
50458 lastActiveIndex = this._nActiveControlInterpolants ++;
50460 let interpolant = interpolants[ lastActiveIndex ];
50462 if ( interpolant === undefined ) {
50464 interpolant = new LinearInterpolant(
50465 new Float32Array( 2 ), new Float32Array( 2 ),
50466 1, _controlInterpolantsResultBuffer );
50468 interpolant.__cacheIndex = lastActiveIndex;
50469 interpolants[ lastActiveIndex ] = interpolant;
50473 return interpolant;
50477 _takeBackControlInterpolant( interpolant ) {
50479 const interpolants = this._controlInterpolants,
50480 prevIndex = interpolant.__cacheIndex,
50482 firstInactiveIndex = -- this._nActiveControlInterpolants,
50484 lastActiveInterpolant = interpolants[ firstInactiveIndex ];
50486 interpolant.__cacheIndex = firstInactiveIndex;
50487 interpolants[ firstInactiveIndex ] = interpolant;
50489 lastActiveInterpolant.__cacheIndex = prevIndex;
50490 interpolants[ prevIndex ] = lastActiveInterpolant;
50494 // return an action for a clip optionally using a custom root target
50495 // object (this method allocates a lot of dynamic memory in case a
50496 // previously unknown clip/root combination is specified)
50497 clipAction( clip, optionalRoot, blendMode ) {
50499 const root = optionalRoot || this._root,
50500 rootUuid = root.uuid;
50502 let clipObject = typeof clip === 'string' ? AnimationClip.findByName( root, clip ) : clip;
50504 const clipUuid = clipObject !== null ? clipObject.uuid : clip;
50506 const actionsForClip = this._actionsByClip[ clipUuid ];
50507 let prototypeAction = null;
50509 if ( blendMode === undefined ) {
50511 if ( clipObject !== null ) {
50513 blendMode = clipObject.blendMode;
50517 blendMode = NormalAnimationBlendMode;
50523 if ( actionsForClip !== undefined ) {
50525 const existingAction = actionsForClip.actionByRoot[ rootUuid ];
50527 if ( existingAction !== undefined && existingAction.blendMode === blendMode ) {
50529 return existingAction;
50533 // we know the clip, so we don't have to parse all
50534 // the bindings again but can just copy
50535 prototypeAction = actionsForClip.knownActions[ 0 ];
50537 // also, take the clip from the prototype action
50538 if ( clipObject === null )
50539 clipObject = prototypeAction._clip;
50543 // clip must be known when specified via string
50544 if ( clipObject === null ) return null;
50546 // allocate all resources required to run it
50547 const newAction = new AnimationAction( this, clipObject, optionalRoot, blendMode );
50549 this._bindAction( newAction, prototypeAction );
50551 // and make the action known to the memory manager
50552 this._addInactiveAction( newAction, clipUuid, rootUuid );
50558 // get an existing action
50559 existingAction( clip, optionalRoot ) {
50561 const root = optionalRoot || this._root,
50562 rootUuid = root.uuid,
50564 clipObject = typeof clip === 'string' ?
50565 AnimationClip.findByName( root, clip ) : clip,
50567 clipUuid = clipObject ? clipObject.uuid : clip,
50569 actionsForClip = this._actionsByClip[ clipUuid ];
50571 if ( actionsForClip !== undefined ) {
50573 return actionsForClip.actionByRoot[ rootUuid ] || null;
50581 // deactivates all previously scheduled actions
50584 const actions = this._actions,
50585 nActions = this._nActiveActions;
50587 for ( let i = nActions - 1; i >= 0; -- i ) {
50589 actions[ i ].stop();
50597 // advance the time and update apply the animation
50598 update( deltaTime ) {
50600 deltaTime *= this.timeScale;
50602 const actions = this._actions,
50603 nActions = this._nActiveActions,
50605 time = this.time += deltaTime,
50606 timeDirection = Math.sign( deltaTime ),
50608 accuIndex = this._accuIndex ^= 1;
50610 // run active actions
50612 for ( let i = 0; i !== nActions; ++ i ) {
50614 const action = actions[ i ];
50616 action._update( time, deltaTime, timeDirection, accuIndex );
50620 // update scene graph
50622 const bindings = this._bindings,
50623 nBindings = this._nActiveBindings;
50625 for ( let i = 0; i !== nBindings; ++ i ) {
50627 bindings[ i ].apply( accuIndex );
50635 // Allows you to seek to a specific time in an animation.
50636 setTime( timeInSeconds ) {
50638 this.time = 0; // Zero out time attribute for AnimationMixer object;
50639 for ( let i = 0; i < this._actions.length; i ++ ) {
50641 this._actions[ i ].time = 0; // Zero out time attribute for all associated AnimationAction objects.
50645 return this.update( timeInSeconds ); // Update used to set exact time. Returns "this" AnimationMixer object.
50649 // return this mixer's root target object
50656 // free all resources specific to a particular clip
50657 uncacheClip( clip ) {
50659 const actions = this._actions,
50660 clipUuid = clip.uuid,
50661 actionsByClip = this._actionsByClip,
50662 actionsForClip = actionsByClip[ clipUuid ];
50664 if ( actionsForClip !== undefined ) {
50666 // note: just calling _removeInactiveAction would mess up the
50667 // iteration state and also require updating the state we can
50670 const actionsToRemove = actionsForClip.knownActions;
50672 for ( let i = 0, n = actionsToRemove.length; i !== n; ++ i ) {
50674 const action = actionsToRemove[ i ];
50676 this._deactivateAction( action );
50678 const cacheIndex = action._cacheIndex,
50679 lastInactiveAction = actions[ actions.length - 1 ];
50681 action._cacheIndex = null;
50682 action._byClipCacheIndex = null;
50684 lastInactiveAction._cacheIndex = cacheIndex;
50685 actions[ cacheIndex ] = lastInactiveAction;
50688 this._removeInactiveBindingsForAction( action );
50692 delete actionsByClip[ clipUuid ];
50698 // free all resources specific to a particular root target object
50699 uncacheRoot( root ) {
50701 const rootUuid = root.uuid,
50702 actionsByClip = this._actionsByClip;
50704 for ( const clipUuid in actionsByClip ) {
50706 const actionByRoot = actionsByClip[ clipUuid ].actionByRoot,
50707 action = actionByRoot[ rootUuid ];
50709 if ( action !== undefined ) {
50711 this._deactivateAction( action );
50712 this._removeInactiveAction( action );
50718 const bindingsByRoot = this._bindingsByRootAndName,
50719 bindingByName = bindingsByRoot[ rootUuid ];
50721 if ( bindingByName !== undefined ) {
50723 for ( const trackName in bindingByName ) {
50725 const binding = bindingByName[ trackName ];
50726 binding.restoreOriginalState();
50727 this._removeInactiveBinding( binding );
50735 // remove a targeted clip from the cache
50736 uncacheAction( clip, optionalRoot ) {
50738 const action = this.existingAction( clip, optionalRoot );
50740 if ( action !== null ) {
50742 this._deactivateAction( action );
50743 this._removeInactiveAction( action );
50753 constructor( value ) {
50755 this.value = value;
50761 return new Uniform( this.value.clone === undefined ? this.value : this.value.clone() );
50769 class UniformsGroup extends EventDispatcher {
50775 this.isUniformsGroup = true;
50777 Object.defineProperty( this, 'id', { value: _id ++ } );
50781 this.usage = StaticDrawUsage;
50782 this.uniforms = [];
50788 this.uniforms.push( uniform );
50794 remove( uniform ) {
50796 const index = this.uniforms.indexOf( uniform );
50798 if ( index !== - 1 ) this.uniforms.splice( index, 1 );
50812 setUsage( value ) {
50814 this.usage = value;
50822 this.dispatchEvent( { type: 'dispose' } );
50830 this.name = source.name;
50831 this.usage = source.usage;
50833 const uniformsSource = source.uniforms;
50835 this.uniforms.length = 0;
50837 for ( let i = 0, l = uniformsSource.length; i < l; i ++ ) {
50839 const uniforms = Array.isArray( uniformsSource[ i ] ) ? uniformsSource[ i ] : [ uniformsSource[ i ] ];
50841 for ( let j = 0; j < uniforms.length; j ++ ) {
50843 this.uniforms.push( uniforms[ j ].clone() );
50855 return new this.constructor().copy( this );
50861 class InstancedInterleavedBuffer extends InterleavedBuffer {
50863 constructor( array, stride, meshPerAttribute = 1 ) {
50865 super( array, stride );
50867 this.isInstancedInterleavedBuffer = true;
50869 this.meshPerAttribute = meshPerAttribute;
50875 super.copy( source );
50877 this.meshPerAttribute = source.meshPerAttribute;
50885 const ib = super.clone( data );
50887 ib.meshPerAttribute = this.meshPerAttribute;
50895 const json = super.toJSON( data );
50897 json.isInstancedInterleavedBuffer = true;
50898 json.meshPerAttribute = this.meshPerAttribute;
50906 class GLBufferAttribute {
50908 constructor( buffer, type, itemSize, elementSize, count ) {
50910 this.isGLBufferAttribute = true;
50914 this.buffer = buffer;
50916 this.itemSize = itemSize;
50917 this.elementSize = elementSize;
50918 this.count = count;
50924 set needsUpdate( value ) {
50926 if ( value === true ) this.version ++;
50930 setBuffer( buffer ) {
50932 this.buffer = buffer;
50938 setType( type, elementSize ) {
50941 this.elementSize = elementSize;
50947 setItemSize( itemSize ) {
50949 this.itemSize = itemSize;
50955 setCount( count ) {
50957 this.count = count;
50967 constructor( origin, direction, near = 0, far = Infinity ) {
50969 this.ray = new Ray( origin, direction );
50970 // direction is assumed to be normalized (for accurate distance calculations)
50974 this.camera = null;
50975 this.layers = new Layers();
50979 Line: { threshold: 1 },
50981 Points: { threshold: 1 },
50987 set( origin, direction ) {
50989 // direction is assumed to be normalized (for accurate distance calculations)
50991 this.ray.set( origin, direction );
50995 setFromCamera( coords, camera ) {
50997 if ( camera.isPerspectiveCamera ) {
50999 this.ray.origin.setFromMatrixPosition( camera.matrixWorld );
51000 this.ray.direction.set( coords.x, coords.y, 0.5 ).unproject( camera ).sub( this.ray.origin ).normalize();
51001 this.camera = camera;
51003 } else if ( camera.isOrthographicCamera ) {
51005 this.ray.origin.set( coords.x, coords.y, ( camera.near + camera.far ) / ( camera.near - camera.far ) ).unproject( camera ); // set origin in plane of camera
51006 this.ray.direction.set( 0, 0, - 1 ).transformDirection( camera.matrixWorld );
51007 this.camera = camera;
51011 console.error( 'THREE.Raycaster: Unsupported camera type: ' + camera.type );
51017 intersectObject( object, recursive = true, intersects = [] ) {
51019 intersectObject( object, this, intersects, recursive );
51021 intersects.sort( ascSort );
51027 intersectObjects( objects, recursive = true, intersects = [] ) {
51029 for ( let i = 0, l = objects.length; i < l; i ++ ) {
51031 intersectObject( objects[ i ], this, intersects, recursive );
51035 intersects.sort( ascSort );
51043 function ascSort( a, b ) {
51045 return a.distance - b.distance;
51049 function intersectObject( object, raycaster, intersects, recursive ) {
51051 if ( object.layers.test( raycaster.layers ) ) {
51053 object.raycast( raycaster, intersects );
51057 if ( recursive === true ) {
51059 const children = object.children;
51061 for ( let i = 0, l = children.length; i < l; i ++ ) {
51063 intersectObject( children[ i ], raycaster, intersects, true );
51081 constructor( radius = 1, phi = 0, theta = 0 ) {
51083 this.radius = radius;
51084 this.phi = phi; // polar angle
51085 this.theta = theta; // azimuthal angle
51091 set( radius, phi, theta ) {
51093 this.radius = radius;
51095 this.theta = theta;
51103 this.radius = other.radius;
51104 this.phi = other.phi;
51105 this.theta = other.theta;
51111 // restrict phi to be between EPS and PI-EPS
51114 const EPS = 0.000001;
51115 this.phi = Math.max( EPS, Math.min( Math.PI - EPS, this.phi ) );
51121 setFromVector3( v ) {
51123 return this.setFromCartesianCoords( v.x, v.y, v.z );
51127 setFromCartesianCoords( x, y, z ) {
51129 this.radius = Math.sqrt( x * x + y * y + z * z );
51131 if ( this.radius === 0 ) {
51138 this.theta = Math.atan2( x, z );
51139 this.phi = Math.acos( clamp( y / this.radius, - 1, 1 ) );
51149 return new this.constructor().copy( this );
51159 class Cylindrical {
51161 constructor( radius = 1, theta = 0, y = 0 ) {
51163 this.radius = radius; // distance from the origin to a point in the x-z plane
51164 this.theta = theta; // counterclockwise angle in the x-z plane measured in radians from the positive z-axis
51165 this.y = y; // height above the x-z plane
51171 set( radius, theta, y ) {
51173 this.radius = radius;
51174 this.theta = theta;
51183 this.radius = other.radius;
51184 this.theta = other.theta;
51191 setFromVector3( v ) {
51193 return this.setFromCartesianCoords( v.x, v.y, v.z );
51197 setFromCartesianCoords( x, y, z ) {
51199 this.radius = Math.sqrt( x * x + z * z );
51200 this.theta = Math.atan2( x, z );
51209 return new this.constructor().copy( this );
51215 const _vector$4 = /*@__PURE__*/ new Vector2();
51219 constructor( min = new Vector2( + Infinity, + Infinity ), max = new Vector2( - Infinity, - Infinity ) ) {
51221 this.isBox2 = true;
51230 this.min.copy( min );
51231 this.max.copy( max );
51237 setFromPoints( points ) {
51241 for ( let i = 0, il = points.length; i < il; i ++ ) {
51243 this.expandByPoint( points[ i ] );
51251 setFromCenterAndSize( center, size ) {
51253 const halfSize = _vector$4.copy( size ).multiplyScalar( 0.5 );
51254 this.min.copy( center ).sub( halfSize );
51255 this.max.copy( center ).add( halfSize );
51263 return new this.constructor().copy( this );
51269 this.min.copy( box.min );
51270 this.max.copy( box.max );
51278 this.min.x = this.min.y = + Infinity;
51279 this.max.x = this.max.y = - Infinity;
51287 // this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes
51289 return ( this.max.x < this.min.x ) || ( this.max.y < this.min.y );
51293 getCenter( target ) {
51295 return this.isEmpty() ? target.set( 0, 0 ) : target.addVectors( this.min, this.max ).multiplyScalar( 0.5 );
51299 getSize( target ) {
51301 return this.isEmpty() ? target.set( 0, 0 ) : target.subVectors( this.max, this.min );
51305 expandByPoint( point ) {
51307 this.min.min( point );
51308 this.max.max( point );
51314 expandByVector( vector ) {
51316 this.min.sub( vector );
51317 this.max.add( vector );
51323 expandByScalar( scalar ) {
51325 this.min.addScalar( - scalar );
51326 this.max.addScalar( scalar );
51332 containsPoint( point ) {
51334 return point.x < this.min.x || point.x > this.max.x ||
51335 point.y < this.min.y || point.y > this.max.y ? false : true;
51339 containsBox( box ) {
51341 return this.min.x <= box.min.x && box.max.x <= this.max.x &&
51342 this.min.y <= box.min.y && box.max.y <= this.max.y;
51346 getParameter( point, target ) {
51348 // This can potentially have a divide by zero if the box
51349 // has a size dimension of 0.
51352 ( point.x - this.min.x ) / ( this.max.x - this.min.x ),
51353 ( point.y - this.min.y ) / ( this.max.y - this.min.y )
51358 intersectsBox( box ) {
51360 // using 4 splitting planes to rule out intersections
51362 return box.max.x < this.min.x || box.min.x > this.max.x ||
51363 box.max.y < this.min.y || box.min.y > this.max.y ? false : true;
51367 clampPoint( point, target ) {
51369 return target.copy( point ).clamp( this.min, this.max );
51373 distanceToPoint( point ) {
51375 return this.clampPoint( point, _vector$4 ).distanceTo( point );
51381 this.min.max( box.min );
51382 this.max.min( box.max );
51384 if ( this.isEmpty() ) this.makeEmpty();
51392 this.min.min( box.min );
51393 this.max.max( box.max );
51399 translate( offset ) {
51401 this.min.add( offset );
51402 this.max.add( offset );
51410 return box.min.equals( this.min ) && box.max.equals( this.max );
51416 const _startP = /*@__PURE__*/ new Vector3();
51417 const _startEnd = /*@__PURE__*/ new Vector3();
51421 constructor( start = new Vector3(), end = new Vector3() ) {
51423 this.start = start;
51428 set( start, end ) {
51430 this.start.copy( start );
51431 this.end.copy( end );
51439 this.start.copy( line.start );
51440 this.end.copy( line.end );
51446 getCenter( target ) {
51448 return target.addVectors( this.start, this.end ).multiplyScalar( 0.5 );
51454 return target.subVectors( this.end, this.start );
51460 return this.start.distanceToSquared( this.end );
51466 return this.start.distanceTo( this.end );
51472 return this.delta( target ).multiplyScalar( t ).add( this.start );
51476 closestPointToPointParameter( point, clampToLine ) {
51478 _startP.subVectors( point, this.start );
51479 _startEnd.subVectors( this.end, this.start );
51481 const startEnd2 = _startEnd.dot( _startEnd );
51482 const startEnd_startP = _startEnd.dot( _startP );
51484 let t = startEnd_startP / startEnd2;
51486 if ( clampToLine ) {
51488 t = clamp( t, 0, 1 );
51496 closestPointToPoint( point, clampToLine, target ) {
51498 const t = this.closestPointToPointParameter( point, clampToLine );
51500 return this.delta( target ).multiplyScalar( t ).add( this.start );
51504 applyMatrix4( matrix ) {
51506 this.start.applyMatrix4( matrix );
51507 this.end.applyMatrix4( matrix );
51515 return line.start.equals( this.start ) && line.end.equals( this.end );
51521 return new this.constructor().copy( this );
51527 const _vector$3 = /*@__PURE__*/ new Vector3();
51529 class SpotLightHelper extends Object3D {
51531 constructor( light, color ) {
51535 this.light = light;
51537 this.matrix = light.matrixWorld;
51538 this.matrixAutoUpdate = false;
51540 this.color = color;
51542 this.type = 'SpotLightHelper';
51544 const geometry = new BufferGeometry();
51546 const positions = [
51549 0, 0, 0, - 1, 0, 1,
51554 for ( let i = 0, j = 1, l = 32; i < l; i ++, j ++ ) {
51556 const p1 = ( i / l ) * Math.PI * 2;
51557 const p2 = ( j / l ) * Math.PI * 2;
51560 Math.cos( p1 ), Math.sin( p1 ), 1,
51561 Math.cos( p2 ), Math.sin( p2 ), 1
51566 geometry.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) );
51568 const material = new LineBasicMaterial( { fog: false, toneMapped: false } );
51570 this.cone = new LineSegments( geometry, material );
51571 this.add( this.cone );
51579 this.cone.geometry.dispose();
51580 this.cone.material.dispose();
51586 this.light.updateWorldMatrix( true, false );
51587 this.light.target.updateWorldMatrix( true, false );
51589 const coneLength = this.light.distance ? this.light.distance : 1000;
51590 const coneWidth = coneLength * Math.tan( this.light.angle );
51592 this.cone.scale.set( coneWidth, coneWidth, coneLength );
51594 _vector$3.setFromMatrixPosition( this.light.target.matrixWorld );
51596 this.cone.lookAt( _vector$3 );
51598 if ( this.color !== undefined ) {
51600 this.cone.material.color.set( this.color );
51604 this.cone.material.color.copy( this.light.color );
51612 const _vector$2 = /*@__PURE__*/ new Vector3();
51613 const _boneMatrix = /*@__PURE__*/ new Matrix4();
51614 const _matrixWorldInv = /*@__PURE__*/ new Matrix4();
51617 class SkeletonHelper extends LineSegments {
51619 constructor( object ) {
51621 const bones = getBoneList( object );
51623 const geometry = new BufferGeometry();
51625 const vertices = [];
51628 const color1 = new Color( 0, 0, 1 );
51629 const color2 = new Color( 0, 1, 0 );
51631 for ( let i = 0; i < bones.length; i ++ ) {
51633 const bone = bones[ i ];
51635 if ( bone.parent && bone.parent.isBone ) {
51637 vertices.push( 0, 0, 0 );
51638 vertices.push( 0, 0, 0 );
51639 colors.push( color1.r, color1.g, color1.b );
51640 colors.push( color2.r, color2.g, color2.b );
51646 geometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
51647 geometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );
51649 const material = new LineBasicMaterial( { vertexColors: true, depthTest: false, depthWrite: false, toneMapped: false, transparent: true } );
51651 super( geometry, material );
51653 this.isSkeletonHelper = true;
51655 this.type = 'SkeletonHelper';
51657 this.root = object;
51658 this.bones = bones;
51660 this.matrix = object.matrixWorld;
51661 this.matrixAutoUpdate = false;
51665 updateMatrixWorld( force ) {
51667 const bones = this.bones;
51669 const geometry = this.geometry;
51670 const position = geometry.getAttribute( 'position' );
51672 _matrixWorldInv.copy( this.root.matrixWorld ).invert();
51674 for ( let i = 0, j = 0; i < bones.length; i ++ ) {
51676 const bone = bones[ i ];
51678 if ( bone.parent && bone.parent.isBone ) {
51680 _boneMatrix.multiplyMatrices( _matrixWorldInv, bone.matrixWorld );
51681 _vector$2.setFromMatrixPosition( _boneMatrix );
51682 position.setXYZ( j, _vector$2.x, _vector$2.y, _vector$2.z );
51684 _boneMatrix.multiplyMatrices( _matrixWorldInv, bone.parent.matrixWorld );
51685 _vector$2.setFromMatrixPosition( _boneMatrix );
51686 position.setXYZ( j + 1, _vector$2.x, _vector$2.y, _vector$2.z );
51694 geometry.getAttribute( 'position' ).needsUpdate = true;
51696 super.updateMatrixWorld( force );
51702 this.geometry.dispose();
51703 this.material.dispose();
51710 function getBoneList( object ) {
51712 const boneList = [];
51714 if ( object.isBone === true ) {
51716 boneList.push( object );
51720 for ( let i = 0; i < object.children.length; i ++ ) {
51722 boneList.push.apply( boneList, getBoneList( object.children[ i ] ) );
51730 class PointLightHelper extends Mesh {
51732 constructor( light, sphereSize, color ) {
51734 const geometry = new SphereGeometry( sphereSize, 4, 2 );
51735 const material = new MeshBasicMaterial( { wireframe: true, fog: false, toneMapped: false } );
51737 super( geometry, material );
51739 this.light = light;
51741 this.color = color;
51743 this.type = 'PointLightHelper';
51745 this.matrix = this.light.matrixWorld;
51746 this.matrixAutoUpdate = false;
51752 // TODO: delete this comment?
51753 const distanceGeometry = new THREE.IcosahedronGeometry( 1, 2 );
51754 const distanceMaterial = new THREE.MeshBasicMaterial( { color: hexColor, fog: false, wireframe: true, opacity: 0.1, transparent: true } );
51756 this.lightSphere = new THREE.Mesh( bulbGeometry, bulbMaterial );
51757 this.lightDistance = new THREE.Mesh( distanceGeometry, distanceMaterial );
51759 const d = light.distance;
51763 this.lightDistance.visible = false;
51767 this.lightDistance.scale.set( d, d, d );
51771 this.add( this.lightDistance );
51778 this.geometry.dispose();
51779 this.material.dispose();
51785 this.light.updateWorldMatrix( true, false );
51787 if ( this.color !== undefined ) {
51789 this.material.color.set( this.color );
51793 this.material.color.copy( this.light.color );
51798 const d = this.light.distance;
51802 this.lightDistance.visible = false;
51806 this.lightDistance.visible = true;
51807 this.lightDistance.scale.set( d, d, d );
51816 const _vector$1 = /*@__PURE__*/ new Vector3();
51817 const _color1 = /*@__PURE__*/ new Color();
51818 const _color2 = /*@__PURE__*/ new Color();
51820 class HemisphereLightHelper extends Object3D {
51822 constructor( light, size, color ) {
51826 this.light = light;
51828 this.matrix = light.matrixWorld;
51829 this.matrixAutoUpdate = false;
51831 this.color = color;
51833 this.type = 'HemisphereLightHelper';
51835 const geometry = new OctahedronGeometry( size );
51836 geometry.rotateY( Math.PI * 0.5 );
51838 this.material = new MeshBasicMaterial( { wireframe: true, fog: false, toneMapped: false } );
51839 if ( this.color === undefined ) this.material.vertexColors = true;
51841 const position = geometry.getAttribute( 'position' );
51842 const colors = new Float32Array( position.count * 3 );
51844 geometry.setAttribute( 'color', new BufferAttribute( colors, 3 ) );
51846 this.add( new Mesh( geometry, this.material ) );
51854 this.children[ 0 ].geometry.dispose();
51855 this.children[ 0 ].material.dispose();
51861 const mesh = this.children[ 0 ];
51863 if ( this.color !== undefined ) {
51865 this.material.color.set( this.color );
51869 const colors = mesh.geometry.getAttribute( 'color' );
51871 _color1.copy( this.light.color );
51872 _color2.copy( this.light.groundColor );
51874 for ( let i = 0, l = colors.count; i < l; i ++ ) {
51876 const color = ( i < ( l / 2 ) ) ? _color1 : _color2;
51878 colors.setXYZ( i, color.r, color.g, color.b );
51882 colors.needsUpdate = true;
51886 this.light.updateWorldMatrix( true, false );
51888 mesh.lookAt( _vector$1.setFromMatrixPosition( this.light.matrixWorld ).negate() );
51894 class GridHelper extends LineSegments {
51896 constructor( size = 10, divisions = 10, color1 = 0x444444, color2 = 0x888888 ) {
51898 color1 = new Color( color1 );
51899 color2 = new Color( color2 );
51901 const center = divisions / 2;
51902 const step = size / divisions;
51903 const halfSize = size / 2;
51905 const vertices = [], colors = [];
51907 for ( let i = 0, j = 0, k = - halfSize; i <= divisions; i ++, k += step ) {
51909 vertices.push( - halfSize, 0, k, halfSize, 0, k );
51910 vertices.push( k, 0, - halfSize, k, 0, halfSize );
51912 const color = i === center ? color1 : color2;
51914 color.toArray( colors, j ); j += 3;
51915 color.toArray( colors, j ); j += 3;
51916 color.toArray( colors, j ); j += 3;
51917 color.toArray( colors, j ); j += 3;
51921 const geometry = new BufferGeometry();
51922 geometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
51923 geometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );
51925 const material = new LineBasicMaterial( { vertexColors: true, toneMapped: false } );
51927 super( geometry, material );
51929 this.type = 'GridHelper';
51935 this.geometry.dispose();
51936 this.material.dispose();
51942 class PolarGridHelper extends LineSegments {
51944 constructor( radius = 10, sectors = 16, rings = 8, divisions = 64, color1 = 0x444444, color2 = 0x888888 ) {
51946 color1 = new Color( color1 );
51947 color2 = new Color( color2 );
51949 const vertices = [];
51952 // create the sectors
51954 if ( sectors > 1 ) {
51956 for ( let i = 0; i < sectors; i ++ ) {
51958 const v = ( i / sectors ) * ( Math.PI * 2 );
51960 const x = Math.sin( v ) * radius;
51961 const z = Math.cos( v ) * radius;
51963 vertices.push( 0, 0, 0 );
51964 vertices.push( x, 0, z );
51966 const color = ( i & 1 ) ? color1 : color2;
51968 colors.push( color.r, color.g, color.b );
51969 colors.push( color.r, color.g, color.b );
51975 // create the rings
51977 for ( let i = 0; i < rings; i ++ ) {
51979 const color = ( i & 1 ) ? color1 : color2;
51981 const r = radius - ( radius / rings * i );
51983 for ( let j = 0; j < divisions; j ++ ) {
51987 let v = ( j / divisions ) * ( Math.PI * 2 );
51989 let x = Math.sin( v ) * r;
51990 let z = Math.cos( v ) * r;
51992 vertices.push( x, 0, z );
51993 colors.push( color.r, color.g, color.b );
51997 v = ( ( j + 1 ) / divisions ) * ( Math.PI * 2 );
51999 x = Math.sin( v ) * r;
52000 z = Math.cos( v ) * r;
52002 vertices.push( x, 0, z );
52003 colors.push( color.r, color.g, color.b );
52009 const geometry = new BufferGeometry();
52010 geometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
52011 geometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );
52013 const material = new LineBasicMaterial( { vertexColors: true, toneMapped: false } );
52015 super( geometry, material );
52017 this.type = 'PolarGridHelper';
52023 this.geometry.dispose();
52024 this.material.dispose();
52030 const _v1 = /*@__PURE__*/ new Vector3();
52031 const _v2 = /*@__PURE__*/ new Vector3();
52032 const _v3 = /*@__PURE__*/ new Vector3();
52034 class DirectionalLightHelper extends Object3D {
52036 constructor( light, size, color ) {
52040 this.light = light;
52042 this.matrix = light.matrixWorld;
52043 this.matrixAutoUpdate = false;
52045 this.color = color;
52047 this.type = 'DirectionalLightHelper';
52049 if ( size === undefined ) size = 1;
52051 let geometry = new BufferGeometry();
52052 geometry.setAttribute( 'position', new Float32BufferAttribute( [
52060 const material = new LineBasicMaterial( { fog: false, toneMapped: false } );
52062 this.lightPlane = new Line( geometry, material );
52063 this.add( this.lightPlane );
52065 geometry = new BufferGeometry();
52066 geometry.setAttribute( 'position', new Float32BufferAttribute( [ 0, 0, 0, 0, 0, 1 ], 3 ) );
52068 this.targetLine = new Line( geometry, material );
52069 this.add( this.targetLine );
52077 this.lightPlane.geometry.dispose();
52078 this.lightPlane.material.dispose();
52079 this.targetLine.geometry.dispose();
52080 this.targetLine.material.dispose();
52086 this.light.updateWorldMatrix( true, false );
52087 this.light.target.updateWorldMatrix( true, false );
52089 _v1.setFromMatrixPosition( this.light.matrixWorld );
52090 _v2.setFromMatrixPosition( this.light.target.matrixWorld );
52091 _v3.subVectors( _v2, _v1 );
52093 this.lightPlane.lookAt( _v2 );
52095 if ( this.color !== undefined ) {
52097 this.lightPlane.material.color.set( this.color );
52098 this.targetLine.material.color.set( this.color );
52102 this.lightPlane.material.color.copy( this.light.color );
52103 this.targetLine.material.color.copy( this.light.color );
52107 this.targetLine.lookAt( _v2 );
52108 this.targetLine.scale.z = _v3.length();
52114 const _vector = /*@__PURE__*/ new Vector3();
52115 const _camera = /*@__PURE__*/ new Camera();
52124 class CameraHelper extends LineSegments {
52126 constructor( camera ) {
52128 const geometry = new BufferGeometry();
52129 const material = new LineBasicMaterial( { color: 0xffffff, vertexColors: true, toneMapped: false } );
52131 const vertices = [];
52134 const pointMap = {};
52138 addLine( 'n1', 'n2' );
52139 addLine( 'n2', 'n4' );
52140 addLine( 'n4', 'n3' );
52141 addLine( 'n3', 'n1' );
52145 addLine( 'f1', 'f2' );
52146 addLine( 'f2', 'f4' );
52147 addLine( 'f4', 'f3' );
52148 addLine( 'f3', 'f1' );
52152 addLine( 'n1', 'f1' );
52153 addLine( 'n2', 'f2' );
52154 addLine( 'n3', 'f3' );
52155 addLine( 'n4', 'f4' );
52159 addLine( 'p', 'n1' );
52160 addLine( 'p', 'n2' );
52161 addLine( 'p', 'n3' );
52162 addLine( 'p', 'n4' );
52166 addLine( 'u1', 'u2' );
52167 addLine( 'u2', 'u3' );
52168 addLine( 'u3', 'u1' );
52172 addLine( 'c', 't' );
52173 addLine( 'p', 'c' );
52177 addLine( 'cn1', 'cn2' );
52178 addLine( 'cn3', 'cn4' );
52180 addLine( 'cf1', 'cf2' );
52181 addLine( 'cf3', 'cf4' );
52183 function addLine( a, b ) {
52190 function addPoint( id ) {
52192 vertices.push( 0, 0, 0 );
52193 colors.push( 0, 0, 0 );
52195 if ( pointMap[ id ] === undefined ) {
52197 pointMap[ id ] = [];
52201 pointMap[ id ].push( ( vertices.length / 3 ) - 1 );
52205 geometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
52206 geometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );
52208 super( geometry, material );
52210 this.type = 'CameraHelper';
52212 this.camera = camera;
52213 if ( this.camera.updateProjectionMatrix ) this.camera.updateProjectionMatrix();
52215 this.matrix = camera.matrixWorld;
52216 this.matrixAutoUpdate = false;
52218 this.pointMap = pointMap;
52224 const colorFrustum = new Color( 0xffaa00 );
52225 const colorCone = new Color( 0xff0000 );
52226 const colorUp = new Color( 0x00aaff );
52227 const colorTarget = new Color( 0xffffff );
52228 const colorCross = new Color( 0x333333 );
52230 this.setColors( colorFrustum, colorCone, colorUp, colorTarget, colorCross );
52234 setColors( frustum, cone, up, target, cross ) {
52236 const geometry = this.geometry;
52238 const colorAttribute = geometry.getAttribute( 'color' );
52242 colorAttribute.setXYZ( 0, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 1, frustum.r, frustum.g, frustum.b ); // n1, n2
52243 colorAttribute.setXYZ( 2, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 3, frustum.r, frustum.g, frustum.b ); // n2, n4
52244 colorAttribute.setXYZ( 4, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 5, frustum.r, frustum.g, frustum.b ); // n4, n3
52245 colorAttribute.setXYZ( 6, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 7, frustum.r, frustum.g, frustum.b ); // n3, n1
52249 colorAttribute.setXYZ( 8, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 9, frustum.r, frustum.g, frustum.b ); // f1, f2
52250 colorAttribute.setXYZ( 10, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 11, frustum.r, frustum.g, frustum.b ); // f2, f4
52251 colorAttribute.setXYZ( 12, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 13, frustum.r, frustum.g, frustum.b ); // f4, f3
52252 colorAttribute.setXYZ( 14, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 15, frustum.r, frustum.g, frustum.b ); // f3, f1
52256 colorAttribute.setXYZ( 16, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 17, frustum.r, frustum.g, frustum.b ); // n1, f1
52257 colorAttribute.setXYZ( 18, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 19, frustum.r, frustum.g, frustum.b ); // n2, f2
52258 colorAttribute.setXYZ( 20, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 21, frustum.r, frustum.g, frustum.b ); // n3, f3
52259 colorAttribute.setXYZ( 22, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 23, frustum.r, frustum.g, frustum.b ); // n4, f4
52263 colorAttribute.setXYZ( 24, cone.r, cone.g, cone.b ); colorAttribute.setXYZ( 25, cone.r, cone.g, cone.b ); // p, n1
52264 colorAttribute.setXYZ( 26, cone.r, cone.g, cone.b ); colorAttribute.setXYZ( 27, cone.r, cone.g, cone.b ); // p, n2
52265 colorAttribute.setXYZ( 28, cone.r, cone.g, cone.b ); colorAttribute.setXYZ( 29, cone.r, cone.g, cone.b ); // p, n3
52266 colorAttribute.setXYZ( 30, cone.r, cone.g, cone.b ); colorAttribute.setXYZ( 31, cone.r, cone.g, cone.b ); // p, n4
52270 colorAttribute.setXYZ( 32, up.r, up.g, up.b ); colorAttribute.setXYZ( 33, up.r, up.g, up.b ); // u1, u2
52271 colorAttribute.setXYZ( 34, up.r, up.g, up.b ); colorAttribute.setXYZ( 35, up.r, up.g, up.b ); // u2, u3
52272 colorAttribute.setXYZ( 36, up.r, up.g, up.b ); colorAttribute.setXYZ( 37, up.r, up.g, up.b ); // u3, u1
52276 colorAttribute.setXYZ( 38, target.r, target.g, target.b ); colorAttribute.setXYZ( 39, target.r, target.g, target.b ); // c, t
52277 colorAttribute.setXYZ( 40, cross.r, cross.g, cross.b ); colorAttribute.setXYZ( 41, cross.r, cross.g, cross.b ); // p, c
52281 colorAttribute.setXYZ( 42, cross.r, cross.g, cross.b ); colorAttribute.setXYZ( 43, cross.r, cross.g, cross.b ); // cn1, cn2
52282 colorAttribute.setXYZ( 44, cross.r, cross.g, cross.b ); colorAttribute.setXYZ( 45, cross.r, cross.g, cross.b ); // cn3, cn4
52284 colorAttribute.setXYZ( 46, cross.r, cross.g, cross.b ); colorAttribute.setXYZ( 47, cross.r, cross.g, cross.b ); // cf1, cf2
52285 colorAttribute.setXYZ( 48, cross.r, cross.g, cross.b ); colorAttribute.setXYZ( 49, cross.r, cross.g, cross.b ); // cf3, cf4
52287 colorAttribute.needsUpdate = true;
52293 const geometry = this.geometry;
52294 const pointMap = this.pointMap;
52296 const w = 1, h = 1;
52298 // we need just camera projection matrix inverse
52299 // world matrix must be identity
52301 _camera.projectionMatrixInverse.copy( this.camera.projectionMatrixInverse );
52305 setPoint( 'c', pointMap, geometry, _camera, 0, 0, - 1 );
52306 setPoint( 't', pointMap, geometry, _camera, 0, 0, 1 );
52310 setPoint( 'n1', pointMap, geometry, _camera, - w, - h, - 1 );
52311 setPoint( 'n2', pointMap, geometry, _camera, w, - h, - 1 );
52312 setPoint( 'n3', pointMap, geometry, _camera, - w, h, - 1 );
52313 setPoint( 'n4', pointMap, geometry, _camera, w, h, - 1 );
52317 setPoint( 'f1', pointMap, geometry, _camera, - w, - h, 1 );
52318 setPoint( 'f2', pointMap, geometry, _camera, w, - h, 1 );
52319 setPoint( 'f3', pointMap, geometry, _camera, - w, h, 1 );
52320 setPoint( 'f4', pointMap, geometry, _camera, w, h, 1 );
52324 setPoint( 'u1', pointMap, geometry, _camera, w * 0.7, h * 1.1, - 1 );
52325 setPoint( 'u2', pointMap, geometry, _camera, - w * 0.7, h * 1.1, - 1 );
52326 setPoint( 'u3', pointMap, geometry, _camera, 0, h * 2, - 1 );
52330 setPoint( 'cf1', pointMap, geometry, _camera, - w, 0, 1 );
52331 setPoint( 'cf2', pointMap, geometry, _camera, w, 0, 1 );
52332 setPoint( 'cf3', pointMap, geometry, _camera, 0, - h, 1 );
52333 setPoint( 'cf4', pointMap, geometry, _camera, 0, h, 1 );
52335 setPoint( 'cn1', pointMap, geometry, _camera, - w, 0, - 1 );
52336 setPoint( 'cn2', pointMap, geometry, _camera, w, 0, - 1 );
52337 setPoint( 'cn3', pointMap, geometry, _camera, 0, - h, - 1 );
52338 setPoint( 'cn4', pointMap, geometry, _camera, 0, h, - 1 );
52340 geometry.getAttribute( 'position' ).needsUpdate = true;
52346 this.geometry.dispose();
52347 this.material.dispose();
52354 function setPoint( point, pointMap, geometry, camera, x, y, z ) {
52356 _vector.set( x, y, z ).unproject( camera );
52358 const points = pointMap[ point ];
52360 if ( points !== undefined ) {
52362 const position = geometry.getAttribute( 'position' );
52364 for ( let i = 0, l = points.length; i < l; i ++ ) {
52366 position.setXYZ( points[ i ], _vector.x, _vector.y, _vector.z );
52374 const _box = /*@__PURE__*/ new Box3();
52376 class BoxHelper extends LineSegments {
52378 constructor( object, color = 0xffff00 ) {
52380 const indices = new Uint16Array( [ 0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7 ] );
52381 const positions = new Float32Array( 8 * 3 );
52383 const geometry = new BufferGeometry();
52384 geometry.setIndex( new BufferAttribute( indices, 1 ) );
52385 geometry.setAttribute( 'position', new BufferAttribute( positions, 3 ) );
52387 super( geometry, new LineBasicMaterial( { color: color, toneMapped: false } ) );
52389 this.object = object;
52390 this.type = 'BoxHelper';
52392 this.matrixAutoUpdate = false;
52400 if ( object !== undefined ) {
52402 console.warn( 'THREE.BoxHelper: .update() has no longer arguments.' );
52406 if ( this.object !== undefined ) {
52408 _box.setFromObject( this.object );
52412 if ( _box.isEmpty() ) return;
52414 const min = _box.min;
52415 const max = _box.max;
52423 0: max.x, max.y, max.z
52424 1: min.x, max.y, max.z
52425 2: min.x, min.y, max.z
52426 3: max.x, min.y, max.z
52427 4: max.x, max.y, min.z
52428 5: min.x, max.y, min.z
52429 6: min.x, min.y, min.z
52430 7: max.x, min.y, min.z
52433 const position = this.geometry.attributes.position;
52434 const array = position.array;
52436 array[ 0 ] = max.x; array[ 1 ] = max.y; array[ 2 ] = max.z;
52437 array[ 3 ] = min.x; array[ 4 ] = max.y; array[ 5 ] = max.z;
52438 array[ 6 ] = min.x; array[ 7 ] = min.y; array[ 8 ] = max.z;
52439 array[ 9 ] = max.x; array[ 10 ] = min.y; array[ 11 ] = max.z;
52440 array[ 12 ] = max.x; array[ 13 ] = max.y; array[ 14 ] = min.z;
52441 array[ 15 ] = min.x; array[ 16 ] = max.y; array[ 17 ] = min.z;
52442 array[ 18 ] = min.x; array[ 19 ] = min.y; array[ 20 ] = min.z;
52443 array[ 21 ] = max.x; array[ 22 ] = min.y; array[ 23 ] = min.z;
52445 position.needsUpdate = true;
52447 this.geometry.computeBoundingSphere();
52451 setFromObject( object ) {
52453 this.object = object;
52460 copy( source, recursive ) {
52462 super.copy( source, recursive );
52464 this.object = source.object;
52472 this.geometry.dispose();
52473 this.material.dispose();
52479 class Box3Helper extends LineSegments {
52481 constructor( box, color = 0xffff00 ) {
52483 const indices = new Uint16Array( [ 0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7 ] );
52485 const positions = [ 1, 1, 1, - 1, 1, 1, - 1, - 1, 1, 1, - 1, 1, 1, 1, - 1, - 1, 1, - 1, - 1, - 1, - 1, 1, - 1, - 1 ];
52487 const geometry = new BufferGeometry();
52489 geometry.setIndex( new BufferAttribute( indices, 1 ) );
52491 geometry.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) );
52493 super( geometry, new LineBasicMaterial( { color: color, toneMapped: false } ) );
52497 this.type = 'Box3Helper';
52499 this.geometry.computeBoundingSphere();
52503 updateMatrixWorld( force ) {
52505 const box = this.box;
52507 if ( box.isEmpty() ) return;
52509 box.getCenter( this.position );
52511 box.getSize( this.scale );
52513 this.scale.multiplyScalar( 0.5 );
52515 super.updateMatrixWorld( force );
52521 this.geometry.dispose();
52522 this.material.dispose();
52528 class PlaneHelper extends Line {
52530 constructor( plane, size = 1, hex = 0xffff00 ) {
52534 const positions = [ 1, - 1, 0, - 1, 1, 0, - 1, - 1, 0, 1, 1, 0, - 1, 1, 0, - 1, - 1, 0, 1, - 1, 0, 1, 1, 0 ];
52536 const geometry = new BufferGeometry();
52537 geometry.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) );
52538 geometry.computeBoundingSphere();
52540 super( geometry, new LineBasicMaterial( { color: color, toneMapped: false } ) );
52542 this.type = 'PlaneHelper';
52544 this.plane = plane;
52548 const positions2 = [ 1, 1, 0, - 1, 1, 0, - 1, - 1, 0, 1, 1, 0, - 1, - 1, 0, 1, - 1, 0 ];
52550 const geometry2 = new BufferGeometry();
52551 geometry2.setAttribute( 'position', new Float32BufferAttribute( positions2, 3 ) );
52552 geometry2.computeBoundingSphere();
52554 this.add( new Mesh( geometry2, new MeshBasicMaterial( { color: color, opacity: 0.2, transparent: true, depthWrite: false, toneMapped: false } ) ) );
52558 updateMatrixWorld( force ) {
52560 this.position.set( 0, 0, 0 );
52562 this.scale.set( 0.5 * this.size, 0.5 * this.size, 1 );
52564 this.lookAt( this.plane.normal );
52566 this.translateZ( - this.plane.constant );
52568 super.updateMatrixWorld( force );
52574 this.geometry.dispose();
52575 this.material.dispose();
52576 this.children[ 0 ].geometry.dispose();
52577 this.children[ 0 ].material.dispose();
52583 const _axis = /*@__PURE__*/ new Vector3();
52584 let _lineGeometry, _coneGeometry;
52586 class ArrowHelper extends Object3D {
52588 // dir is assumed to be normalized
52590 constructor( dir = new Vector3( 0, 0, 1 ), origin = new Vector3( 0, 0, 0 ), length = 1, color = 0xffff00, headLength = length * 0.2, headWidth = headLength * 0.2 ) {
52594 this.type = 'ArrowHelper';
52596 if ( _lineGeometry === undefined ) {
52598 _lineGeometry = new BufferGeometry();
52599 _lineGeometry.setAttribute( 'position', new Float32BufferAttribute( [ 0, 0, 0, 0, 1, 0 ], 3 ) );
52601 _coneGeometry = new CylinderGeometry( 0, 0.5, 1, 5, 1 );
52602 _coneGeometry.translate( 0, - 0.5, 0 );
52606 this.position.copy( origin );
52608 this.line = new Line( _lineGeometry, new LineBasicMaterial( { color: color, toneMapped: false } ) );
52609 this.line.matrixAutoUpdate = false;
52610 this.add( this.line );
52612 this.cone = new Mesh( _coneGeometry, new MeshBasicMaterial( { color: color, toneMapped: false } ) );
52613 this.cone.matrixAutoUpdate = false;
52614 this.add( this.cone );
52616 this.setDirection( dir );
52617 this.setLength( length, headLength, headWidth );
52621 setDirection( dir ) {
52623 // dir is assumed to be normalized
52625 if ( dir.y > 0.99999 ) {
52627 this.quaternion.set( 0, 0, 0, 1 );
52629 } else if ( dir.y < - 0.99999 ) {
52631 this.quaternion.set( 1, 0, 0, 0 );
52635 _axis.set( dir.z, 0, - dir.x ).normalize();
52637 const radians = Math.acos( dir.y );
52639 this.quaternion.setFromAxisAngle( _axis, radians );
52645 setLength( length, headLength = length * 0.2, headWidth = headLength * 0.2 ) {
52647 this.line.scale.set( 1, Math.max( 0.0001, length - headLength ), 1 ); // see #17458
52648 this.line.updateMatrix();
52650 this.cone.scale.set( headWidth, headLength, headWidth );
52651 this.cone.position.y = length;
52652 this.cone.updateMatrix();
52656 setColor( color ) {
52658 this.line.material.color.set( color );
52659 this.cone.material.color.set( color );
52665 super.copy( source, false );
52667 this.line.copy( source.line );
52668 this.cone.copy( source.cone );
52676 this.line.geometry.dispose();
52677 this.line.material.dispose();
52678 this.cone.geometry.dispose();
52679 this.cone.material.dispose();
52685 class AxesHelper extends LineSegments {
52687 constructor( size = 1 ) {
52690 0, 0, 0, size, 0, 0,
52691 0, 0, 0, 0, size, 0,
52692 0, 0, 0, 0, 0, size
52696 1, 0, 0, 1, 0.6, 0,
52697 0, 1, 0, 0.6, 1, 0,
52701 const geometry = new BufferGeometry();
52702 geometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
52703 geometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );
52705 const material = new LineBasicMaterial( { vertexColors: true, toneMapped: false } );
52707 super( geometry, material );
52709 this.type = 'AxesHelper';
52713 setColors( xAxisColor, yAxisColor, zAxisColor ) {
52715 const color = new Color();
52716 const array = this.geometry.attributes.color.array;
52718 color.set( xAxisColor );
52719 color.toArray( array, 0 );
52720 color.toArray( array, 3 );
52722 color.set( yAxisColor );
52723 color.toArray( array, 6 );
52724 color.toArray( array, 9 );
52726 color.set( zAxisColor );
52727 color.toArray( array, 12 );
52728 color.toArray( array, 15 );
52730 this.geometry.attributes.color.needsUpdate = true;
52738 this.geometry.dispose();
52739 this.material.dispose();
52749 this.type = 'ShapePath';
52751 this.color = new Color();
52753 this.subPaths = [];
52754 this.currentPath = null;
52760 this.currentPath = new Path();
52761 this.subPaths.push( this.currentPath );
52762 this.currentPath.moveTo( x, y );
52770 this.currentPath.lineTo( x, y );
52776 quadraticCurveTo( aCPx, aCPy, aX, aY ) {
52778 this.currentPath.quadraticCurveTo( aCPx, aCPy, aX, aY );
52784 bezierCurveTo( aCP1x, aCP1y, aCP2x, aCP2y, aX, aY ) {
52786 this.currentPath.bezierCurveTo( aCP1x, aCP1y, aCP2x, aCP2y, aX, aY );
52792 splineThru( pts ) {
52794 this.currentPath.splineThru( pts );
52800 toShapes( isCCW ) {
52802 function toShapesNoHoles( inSubpaths ) {
52806 for ( let i = 0, l = inSubpaths.length; i < l; i ++ ) {
52808 const tmpPath = inSubpaths[ i ];
52810 const tmpShape = new Shape();
52811 tmpShape.curves = tmpPath.curves;
52813 shapes.push( tmpShape );
52821 function isPointInsidePolygon( inPt, inPolygon ) {
52823 const polyLen = inPolygon.length;
52825 // inPt on polygon contour => immediate success or
52826 // toggling of inside/outside at every single! intersection point of an edge
52827 // with the horizontal line through inPt, left of inPt
52828 // not counting lowerY endpoints of edges and whole edges on that line
52829 let inside = false;
52830 for ( let p = polyLen - 1, q = 0; q < polyLen; p = q ++ ) {
52832 let edgeLowPt = inPolygon[ p ];
52833 let edgeHighPt = inPolygon[ q ];
52835 let edgeDx = edgeHighPt.x - edgeLowPt.x;
52836 let edgeDy = edgeHighPt.y - edgeLowPt.y;
52838 if ( Math.abs( edgeDy ) > Number.EPSILON ) {
52841 if ( edgeDy < 0 ) {
52843 edgeLowPt = inPolygon[ q ]; edgeDx = - edgeDx;
52844 edgeHighPt = inPolygon[ p ]; edgeDy = - edgeDy;
52848 if ( ( inPt.y < edgeLowPt.y ) || ( inPt.y > edgeHighPt.y ) ) continue;
52850 if ( inPt.y === edgeLowPt.y ) {
52852 if ( inPt.x === edgeLowPt.x ) return true; // inPt is on contour ?
52853 // continue; // no intersection or edgeLowPt => doesn't count !!!
52857 const perpEdge = edgeDy * ( inPt.x - edgeLowPt.x ) - edgeDx * ( inPt.y - edgeLowPt.y );
52858 if ( perpEdge === 0 ) return true; // inPt is on contour ?
52859 if ( perpEdge < 0 ) continue;
52860 inside = ! inside; // true intersection left of inPt
52866 // parallel or collinear
52867 if ( inPt.y !== edgeLowPt.y ) continue; // parallel
52868 // edge lies on the same horizontal line as inPt
52869 if ( ( ( edgeHighPt.x <= inPt.x ) && ( inPt.x <= edgeLowPt.x ) ) ||
52870 ( ( edgeLowPt.x <= inPt.x ) && ( inPt.x <= edgeHighPt.x ) ) ) return true; // inPt: Point on contour !
52881 const isClockWise = ShapeUtils.isClockWise;
52883 const subPaths = this.subPaths;
52884 if ( subPaths.length === 0 ) return [];
52886 let solid, tmpPath, tmpShape;
52889 if ( subPaths.length === 1 ) {
52891 tmpPath = subPaths[ 0 ];
52892 tmpShape = new Shape();
52893 tmpShape.curves = tmpPath.curves;
52894 shapes.push( tmpShape );
52899 let holesFirst = ! isClockWise( subPaths[ 0 ].getPoints() );
52900 holesFirst = isCCW ? ! holesFirst : holesFirst;
52904 const betterShapeHoles = [];
52905 const newShapes = [];
52906 let newShapeHoles = [];
52910 newShapes[ mainIdx ] = undefined;
52911 newShapeHoles[ mainIdx ] = [];
52913 for ( let i = 0, l = subPaths.length; i < l; i ++ ) {
52915 tmpPath = subPaths[ i ];
52916 tmpPoints = tmpPath.getPoints();
52917 solid = isClockWise( tmpPoints );
52918 solid = isCCW ? ! solid : solid;
52922 if ( ( ! holesFirst ) && ( newShapes[ mainIdx ] ) ) mainIdx ++;
52924 newShapes[ mainIdx ] = { s: new Shape(), p: tmpPoints };
52925 newShapes[ mainIdx ].s.curves = tmpPath.curves;
52927 if ( holesFirst ) mainIdx ++;
52928 newShapeHoles[ mainIdx ] = [];
52930 //console.log('cw', i);
52934 newShapeHoles[ mainIdx ].push( { h: tmpPath, p: tmpPoints[ 0 ] } );
52936 //console.log('ccw', i);
52942 // only Holes? -> probably all Shapes with wrong orientation
52943 if ( ! newShapes[ 0 ] ) return toShapesNoHoles( subPaths );
52946 if ( newShapes.length > 1 ) {
52948 let ambiguous = false;
52951 for ( let sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx ++ ) {
52953 betterShapeHoles[ sIdx ] = [];
52957 for ( let sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx ++ ) {
52959 const sho = newShapeHoles[ sIdx ];
52961 for ( let hIdx = 0; hIdx < sho.length; hIdx ++ ) {
52963 const ho = sho[ hIdx ];
52964 let hole_unassigned = true;
52966 for ( let s2Idx = 0; s2Idx < newShapes.length; s2Idx ++ ) {
52968 if ( isPointInsidePolygon( ho.p, newShapes[ s2Idx ].p ) ) {
52970 if ( sIdx !== s2Idx ) toChange ++;
52972 if ( hole_unassigned ) {
52974 hole_unassigned = false;
52975 betterShapeHoles[ s2Idx ].push( ho );
52987 if ( hole_unassigned ) {
52989 betterShapeHoles[ sIdx ].push( ho );
52997 if ( toChange > 0 && ambiguous === false ) {
52999 newShapeHoles = betterShapeHoles;
53007 for ( let i = 0, il = newShapes.length; i < il; i ++ ) {
53009 tmpShape = newShapes[ i ].s;
53010 shapes.push( tmpShape );
53011 tmpHoles = newShapeHoles[ i ];
53013 for ( let j = 0, jl = tmpHoles.length; j < jl; j ++ ) {
53015 tmpShape.holes.push( tmpHoles[ j ].h );
53021 //console.log("shape", shapes);
53029 if ( typeof __THREE_DEVTOOLS__ !== 'undefined' ) {
53031 __THREE_DEVTOOLS__.dispatchEvent( new CustomEvent( 'register', { detail: {
53032 revision: REVISION,
53037 if ( typeof window !== 'undefined' ) {
53039 if ( window.__THREE__ ) {
53041 console.warn( 'WARNING: Multiple instances of Three.js being imported.' );
53045 window.__THREE__ = REVISION;
53051 exports.ACESFilmicToneMapping = ACESFilmicToneMapping;
53052 exports.AddEquation = AddEquation;
53053 exports.AddOperation = AddOperation;
53054 exports.AdditiveAnimationBlendMode = AdditiveAnimationBlendMode;
53055 exports.AdditiveBlending = AdditiveBlending;
53056 exports.AgXToneMapping = AgXToneMapping;
53057 exports.AlphaFormat = AlphaFormat;
53058 exports.AlwaysCompare = AlwaysCompare;
53059 exports.AlwaysDepth = AlwaysDepth;
53060 exports.AlwaysStencilFunc = AlwaysStencilFunc;
53061 exports.AmbientLight = AmbientLight;
53062 exports.AnimationAction = AnimationAction;
53063 exports.AnimationClip = AnimationClip;
53064 exports.AnimationLoader = AnimationLoader;
53065 exports.AnimationMixer = AnimationMixer;
53066 exports.AnimationObjectGroup = AnimationObjectGroup;
53067 exports.AnimationUtils = AnimationUtils;
53068 exports.ArcCurve = ArcCurve;
53069 exports.ArrayCamera = ArrayCamera;
53070 exports.ArrowHelper = ArrowHelper;
53071 exports.AttachedBindMode = AttachedBindMode;
53072 exports.Audio = Audio;
53073 exports.AudioAnalyser = AudioAnalyser;
53074 exports.AudioContext = AudioContext;
53075 exports.AudioListener = AudioListener;
53076 exports.AudioLoader = AudioLoader;
53077 exports.AxesHelper = AxesHelper;
53078 exports.BackSide = BackSide;
53079 exports.BasicDepthPacking = BasicDepthPacking;
53080 exports.BasicShadowMap = BasicShadowMap;
53081 exports.BatchedMesh = BatchedMesh;
53082 exports.Bone = Bone;
53083 exports.BooleanKeyframeTrack = BooleanKeyframeTrack;
53084 exports.Box2 = Box2;
53085 exports.Box3 = Box3;
53086 exports.Box3Helper = Box3Helper;
53087 exports.BoxGeometry = BoxGeometry;
53088 exports.BoxHelper = BoxHelper;
53089 exports.BufferAttribute = BufferAttribute;
53090 exports.BufferGeometry = BufferGeometry;
53091 exports.BufferGeometryLoader = BufferGeometryLoader;
53092 exports.ByteType = ByteType;
53093 exports.Cache = Cache;
53094 exports.Camera = Camera;
53095 exports.CameraHelper = CameraHelper;
53096 exports.CanvasTexture = CanvasTexture;
53097 exports.CapsuleGeometry = CapsuleGeometry;
53098 exports.CatmullRomCurve3 = CatmullRomCurve3;
53099 exports.CineonToneMapping = CineonToneMapping;
53100 exports.CircleGeometry = CircleGeometry;
53101 exports.ClampToEdgeWrapping = ClampToEdgeWrapping;
53102 exports.Clock = Clock;
53103 exports.Color = Color;
53104 exports.ColorKeyframeTrack = ColorKeyframeTrack;
53105 exports.ColorManagement = ColorManagement;
53106 exports.CompressedArrayTexture = CompressedArrayTexture;
53107 exports.CompressedCubeTexture = CompressedCubeTexture;
53108 exports.CompressedTexture = CompressedTexture;
53109 exports.CompressedTextureLoader = CompressedTextureLoader;
53110 exports.ConeGeometry = ConeGeometry;
53111 exports.ConstantAlphaFactor = ConstantAlphaFactor;
53112 exports.ConstantColorFactor = ConstantColorFactor;
53113 exports.CubeCamera = CubeCamera;
53114 exports.CubeReflectionMapping = CubeReflectionMapping;
53115 exports.CubeRefractionMapping = CubeRefractionMapping;
53116 exports.CubeTexture = CubeTexture;
53117 exports.CubeTextureLoader = CubeTextureLoader;
53118 exports.CubeUVReflectionMapping = CubeUVReflectionMapping;
53119 exports.CubicBezierCurve = CubicBezierCurve;
53120 exports.CubicBezierCurve3 = CubicBezierCurve3;
53121 exports.CubicInterpolant = CubicInterpolant;
53122 exports.CullFaceBack = CullFaceBack;
53123 exports.CullFaceFront = CullFaceFront;
53124 exports.CullFaceFrontBack = CullFaceFrontBack;
53125 exports.CullFaceNone = CullFaceNone;
53126 exports.Curve = Curve;
53127 exports.CurvePath = CurvePath;
53128 exports.CustomBlending = CustomBlending;
53129 exports.CustomToneMapping = CustomToneMapping;
53130 exports.CylinderGeometry = CylinderGeometry;
53131 exports.Cylindrical = Cylindrical;
53132 exports.Data3DTexture = Data3DTexture;
53133 exports.DataArrayTexture = DataArrayTexture;
53134 exports.DataTexture = DataTexture;
53135 exports.DataTextureLoader = DataTextureLoader;
53136 exports.DataUtils = DataUtils;
53137 exports.DecrementStencilOp = DecrementStencilOp;
53138 exports.DecrementWrapStencilOp = DecrementWrapStencilOp;
53139 exports.DefaultLoadingManager = DefaultLoadingManager;
53140 exports.DepthFormat = DepthFormat;
53141 exports.DepthStencilFormat = DepthStencilFormat;
53142 exports.DepthTexture = DepthTexture;
53143 exports.DetachedBindMode = DetachedBindMode;
53144 exports.DirectionalLight = DirectionalLight;
53145 exports.DirectionalLightHelper = DirectionalLightHelper;
53146 exports.DiscreteInterpolant = DiscreteInterpolant;
53147 exports.DisplayP3ColorSpace = DisplayP3ColorSpace;
53148 exports.DodecahedronGeometry = DodecahedronGeometry;
53149 exports.DoubleSide = DoubleSide;
53150 exports.DstAlphaFactor = DstAlphaFactor;
53151 exports.DstColorFactor = DstColorFactor;
53152 exports.DynamicCopyUsage = DynamicCopyUsage;
53153 exports.DynamicDrawUsage = DynamicDrawUsage;
53154 exports.DynamicReadUsage = DynamicReadUsage;
53155 exports.EdgesGeometry = EdgesGeometry;
53156 exports.EllipseCurve = EllipseCurve;
53157 exports.EqualCompare = EqualCompare;
53158 exports.EqualDepth = EqualDepth;
53159 exports.EqualStencilFunc = EqualStencilFunc;
53160 exports.EquirectangularReflectionMapping = EquirectangularReflectionMapping;
53161 exports.EquirectangularRefractionMapping = EquirectangularRefractionMapping;
53162 exports.Euler = Euler;
53163 exports.EventDispatcher = EventDispatcher;
53164 exports.ExtrudeGeometry = ExtrudeGeometry;
53165 exports.FileLoader = FileLoader;
53166 exports.Float16BufferAttribute = Float16BufferAttribute;
53167 exports.Float32BufferAttribute = Float32BufferAttribute;
53168 exports.Float64BufferAttribute = Float64BufferAttribute;
53169 exports.FloatType = FloatType;
53171 exports.FogExp2 = FogExp2;
53172 exports.FramebufferTexture = FramebufferTexture;
53173 exports.FrontSide = FrontSide;
53174 exports.Frustum = Frustum;
53175 exports.GLBufferAttribute = GLBufferAttribute;
53176 exports.GLSL1 = GLSL1;
53177 exports.GLSL3 = GLSL3;
53178 exports.GreaterCompare = GreaterCompare;
53179 exports.GreaterDepth = GreaterDepth;
53180 exports.GreaterEqualCompare = GreaterEqualCompare;
53181 exports.GreaterEqualDepth = GreaterEqualDepth;
53182 exports.GreaterEqualStencilFunc = GreaterEqualStencilFunc;
53183 exports.GreaterStencilFunc = GreaterStencilFunc;
53184 exports.GridHelper = GridHelper;
53185 exports.Group = Group;
53186 exports.HalfFloatType = HalfFloatType;
53187 exports.HemisphereLight = HemisphereLight;
53188 exports.HemisphereLightHelper = HemisphereLightHelper;
53189 exports.IcosahedronGeometry = IcosahedronGeometry;
53190 exports.ImageBitmapLoader = ImageBitmapLoader;
53191 exports.ImageLoader = ImageLoader;
53192 exports.ImageUtils = ImageUtils;
53193 exports.IncrementStencilOp = IncrementStencilOp;
53194 exports.IncrementWrapStencilOp = IncrementWrapStencilOp;
53195 exports.InstancedBufferAttribute = InstancedBufferAttribute;
53196 exports.InstancedBufferGeometry = InstancedBufferGeometry;
53197 exports.InstancedInterleavedBuffer = InstancedInterleavedBuffer;
53198 exports.InstancedMesh = InstancedMesh;
53199 exports.Int16BufferAttribute = Int16BufferAttribute;
53200 exports.Int32BufferAttribute = Int32BufferAttribute;
53201 exports.Int8BufferAttribute = Int8BufferAttribute;
53202 exports.IntType = IntType;
53203 exports.InterleavedBuffer = InterleavedBuffer;
53204 exports.InterleavedBufferAttribute = InterleavedBufferAttribute;
53205 exports.Interpolant = Interpolant;
53206 exports.InterpolateDiscrete = InterpolateDiscrete;
53207 exports.InterpolateLinear = InterpolateLinear;
53208 exports.InterpolateSmooth = InterpolateSmooth;
53209 exports.InvertStencilOp = InvertStencilOp;
53210 exports.KeepStencilOp = KeepStencilOp;
53211 exports.KeyframeTrack = KeyframeTrack;
53213 exports.LatheGeometry = LatheGeometry;
53214 exports.Layers = Layers;
53215 exports.LessCompare = LessCompare;
53216 exports.LessDepth = LessDepth;
53217 exports.LessEqualCompare = LessEqualCompare;
53218 exports.LessEqualDepth = LessEqualDepth;
53219 exports.LessEqualStencilFunc = LessEqualStencilFunc;
53220 exports.LessStencilFunc = LessStencilFunc;
53221 exports.Light = Light;
53222 exports.LightProbe = LightProbe;
53223 exports.Line = Line;
53224 exports.Line3 = Line3;
53225 exports.LineBasicMaterial = LineBasicMaterial;
53226 exports.LineCurve = LineCurve;
53227 exports.LineCurve3 = LineCurve3;
53228 exports.LineDashedMaterial = LineDashedMaterial;
53229 exports.LineLoop = LineLoop;
53230 exports.LineSegments = LineSegments;
53231 exports.LinearDisplayP3ColorSpace = LinearDisplayP3ColorSpace;
53232 exports.LinearEncoding = LinearEncoding;
53233 exports.LinearFilter = LinearFilter;
53234 exports.LinearInterpolant = LinearInterpolant;
53235 exports.LinearMipMapLinearFilter = LinearMipMapLinearFilter;
53236 exports.LinearMipMapNearestFilter = LinearMipMapNearestFilter;
53237 exports.LinearMipmapLinearFilter = LinearMipmapLinearFilter;
53238 exports.LinearMipmapNearestFilter = LinearMipmapNearestFilter;
53239 exports.LinearSRGBColorSpace = LinearSRGBColorSpace;
53240 exports.LinearToneMapping = LinearToneMapping;
53241 exports.LinearTransfer = LinearTransfer;
53242 exports.Loader = Loader;
53243 exports.LoaderUtils = LoaderUtils;
53244 exports.LoadingManager = LoadingManager;
53245 exports.LoopOnce = LoopOnce;
53246 exports.LoopPingPong = LoopPingPong;
53247 exports.LoopRepeat = LoopRepeat;
53248 exports.LuminanceAlphaFormat = LuminanceAlphaFormat;
53249 exports.LuminanceFormat = LuminanceFormat;
53250 exports.MOUSE = MOUSE;
53251 exports.Material = Material;
53252 exports.MaterialLoader = MaterialLoader;
53253 exports.MathUtils = MathUtils;
53254 exports.Matrix3 = Matrix3;
53255 exports.Matrix4 = Matrix4;
53256 exports.MaxEquation = MaxEquation;
53257 exports.Mesh = Mesh;
53258 exports.MeshBasicMaterial = MeshBasicMaterial;
53259 exports.MeshDepthMaterial = MeshDepthMaterial;
53260 exports.MeshDistanceMaterial = MeshDistanceMaterial;
53261 exports.MeshLambertMaterial = MeshLambertMaterial;
53262 exports.MeshMatcapMaterial = MeshMatcapMaterial;
53263 exports.MeshNormalMaterial = MeshNormalMaterial;
53264 exports.MeshPhongMaterial = MeshPhongMaterial;
53265 exports.MeshPhysicalMaterial = MeshPhysicalMaterial;
53266 exports.MeshStandardMaterial = MeshStandardMaterial;
53267 exports.MeshToonMaterial = MeshToonMaterial;
53268 exports.MinEquation = MinEquation;
53269 exports.MirroredRepeatWrapping = MirroredRepeatWrapping;
53270 exports.MixOperation = MixOperation;
53271 exports.MultiplyBlending = MultiplyBlending;
53272 exports.MultiplyOperation = MultiplyOperation;
53273 exports.NearestFilter = NearestFilter;
53274 exports.NearestMipMapLinearFilter = NearestMipMapLinearFilter;
53275 exports.NearestMipMapNearestFilter = NearestMipMapNearestFilter;
53276 exports.NearestMipmapLinearFilter = NearestMipmapLinearFilter;
53277 exports.NearestMipmapNearestFilter = NearestMipmapNearestFilter;
53278 exports.NeverCompare = NeverCompare;
53279 exports.NeverDepth = NeverDepth;
53280 exports.NeverStencilFunc = NeverStencilFunc;
53281 exports.NoBlending = NoBlending;
53282 exports.NoColorSpace = NoColorSpace;
53283 exports.NoToneMapping = NoToneMapping;
53284 exports.NormalAnimationBlendMode = NormalAnimationBlendMode;
53285 exports.NormalBlending = NormalBlending;
53286 exports.NotEqualCompare = NotEqualCompare;
53287 exports.NotEqualDepth = NotEqualDepth;
53288 exports.NotEqualStencilFunc = NotEqualStencilFunc;
53289 exports.NumberKeyframeTrack = NumberKeyframeTrack;
53290 exports.Object3D = Object3D;
53291 exports.ObjectLoader = ObjectLoader;
53292 exports.ObjectSpaceNormalMap = ObjectSpaceNormalMap;
53293 exports.OctahedronGeometry = OctahedronGeometry;
53294 exports.OneFactor = OneFactor;
53295 exports.OneMinusConstantAlphaFactor = OneMinusConstantAlphaFactor;
53296 exports.OneMinusConstantColorFactor = OneMinusConstantColorFactor;
53297 exports.OneMinusDstAlphaFactor = OneMinusDstAlphaFactor;
53298 exports.OneMinusDstColorFactor = OneMinusDstColorFactor;
53299 exports.OneMinusSrcAlphaFactor = OneMinusSrcAlphaFactor;
53300 exports.OneMinusSrcColorFactor = OneMinusSrcColorFactor;
53301 exports.OrthographicCamera = OrthographicCamera;
53302 exports.P3Primaries = P3Primaries;
53303 exports.PCFShadowMap = PCFShadowMap;
53304 exports.PCFSoftShadowMap = PCFSoftShadowMap;
53305 exports.PMREMGenerator = PMREMGenerator;
53306 exports.Path = Path;
53307 exports.PerspectiveCamera = PerspectiveCamera;
53308 exports.Plane = Plane;
53309 exports.PlaneGeometry = PlaneGeometry;
53310 exports.PlaneHelper = PlaneHelper;
53311 exports.PointLight = PointLight;
53312 exports.PointLightHelper = PointLightHelper;
53313 exports.Points = Points;
53314 exports.PointsMaterial = PointsMaterial;
53315 exports.PolarGridHelper = PolarGridHelper;
53316 exports.PolyhedronGeometry = PolyhedronGeometry;
53317 exports.PositionalAudio = PositionalAudio;
53318 exports.PropertyBinding = PropertyBinding;
53319 exports.PropertyMixer = PropertyMixer;
53320 exports.QuadraticBezierCurve = QuadraticBezierCurve;
53321 exports.QuadraticBezierCurve3 = QuadraticBezierCurve3;
53322 exports.Quaternion = Quaternion;
53323 exports.QuaternionKeyframeTrack = QuaternionKeyframeTrack;
53324 exports.QuaternionLinearInterpolant = QuaternionLinearInterpolant;
53325 exports.RED_GREEN_RGTC2_Format = RED_GREEN_RGTC2_Format;
53326 exports.RED_RGTC1_Format = RED_RGTC1_Format;
53327 exports.REVISION = REVISION;
53328 exports.RGBADepthPacking = RGBADepthPacking;
53329 exports.RGBAFormat = RGBAFormat;
53330 exports.RGBAIntegerFormat = RGBAIntegerFormat;
53331 exports.RGBA_ASTC_10x10_Format = RGBA_ASTC_10x10_Format;
53332 exports.RGBA_ASTC_10x5_Format = RGBA_ASTC_10x5_Format;
53333 exports.RGBA_ASTC_10x6_Format = RGBA_ASTC_10x6_Format;
53334 exports.RGBA_ASTC_10x8_Format = RGBA_ASTC_10x8_Format;
53335 exports.RGBA_ASTC_12x10_Format = RGBA_ASTC_12x10_Format;
53336 exports.RGBA_ASTC_12x12_Format = RGBA_ASTC_12x12_Format;
53337 exports.RGBA_ASTC_4x4_Format = RGBA_ASTC_4x4_Format;
53338 exports.RGBA_ASTC_5x4_Format = RGBA_ASTC_5x4_Format;
53339 exports.RGBA_ASTC_5x5_Format = RGBA_ASTC_5x5_Format;
53340 exports.RGBA_ASTC_6x5_Format = RGBA_ASTC_6x5_Format;
53341 exports.RGBA_ASTC_6x6_Format = RGBA_ASTC_6x6_Format;
53342 exports.RGBA_ASTC_8x5_Format = RGBA_ASTC_8x5_Format;
53343 exports.RGBA_ASTC_8x6_Format = RGBA_ASTC_8x6_Format;
53344 exports.RGBA_ASTC_8x8_Format = RGBA_ASTC_8x8_Format;
53345 exports.RGBA_BPTC_Format = RGBA_BPTC_Format;
53346 exports.RGBA_ETC2_EAC_Format = RGBA_ETC2_EAC_Format;
53347 exports.RGBA_PVRTC_2BPPV1_Format = RGBA_PVRTC_2BPPV1_Format;
53348 exports.RGBA_PVRTC_4BPPV1_Format = RGBA_PVRTC_4BPPV1_Format;
53349 exports.RGBA_S3TC_DXT1_Format = RGBA_S3TC_DXT1_Format;
53350 exports.RGBA_S3TC_DXT3_Format = RGBA_S3TC_DXT3_Format;
53351 exports.RGBA_S3TC_DXT5_Format = RGBA_S3TC_DXT5_Format;
53352 exports.RGB_BPTC_SIGNED_Format = RGB_BPTC_SIGNED_Format;
53353 exports.RGB_BPTC_UNSIGNED_Format = RGB_BPTC_UNSIGNED_Format;
53354 exports.RGB_ETC1_Format = RGB_ETC1_Format;
53355 exports.RGB_ETC2_Format = RGB_ETC2_Format;
53356 exports.RGB_PVRTC_2BPPV1_Format = RGB_PVRTC_2BPPV1_Format;
53357 exports.RGB_PVRTC_4BPPV1_Format = RGB_PVRTC_4BPPV1_Format;
53358 exports.RGB_S3TC_DXT1_Format = RGB_S3TC_DXT1_Format;
53359 exports.RGFormat = RGFormat;
53360 exports.RGIntegerFormat = RGIntegerFormat;
53361 exports.RawShaderMaterial = RawShaderMaterial;
53363 exports.Raycaster = Raycaster;
53364 exports.Rec709Primaries = Rec709Primaries;
53365 exports.RectAreaLight = RectAreaLight;
53366 exports.RedFormat = RedFormat;
53367 exports.RedIntegerFormat = RedIntegerFormat;
53368 exports.ReinhardToneMapping = ReinhardToneMapping;
53369 exports.RenderTarget = RenderTarget;
53370 exports.RepeatWrapping = RepeatWrapping;
53371 exports.ReplaceStencilOp = ReplaceStencilOp;
53372 exports.ReverseSubtractEquation = ReverseSubtractEquation;
53373 exports.RingGeometry = RingGeometry;
53374 exports.SIGNED_RED_GREEN_RGTC2_Format = SIGNED_RED_GREEN_RGTC2_Format;
53375 exports.SIGNED_RED_RGTC1_Format = SIGNED_RED_RGTC1_Format;
53376 exports.SRGBColorSpace = SRGBColorSpace;
53377 exports.SRGBTransfer = SRGBTransfer;
53378 exports.Scene = Scene;
53379 exports.ShaderChunk = ShaderChunk;
53380 exports.ShaderLib = ShaderLib;
53381 exports.ShaderMaterial = ShaderMaterial;
53382 exports.ShadowMaterial = ShadowMaterial;
53383 exports.Shape = Shape;
53384 exports.ShapeGeometry = ShapeGeometry;
53385 exports.ShapePath = ShapePath;
53386 exports.ShapeUtils = ShapeUtils;
53387 exports.ShortType = ShortType;
53388 exports.Skeleton = Skeleton;
53389 exports.SkeletonHelper = SkeletonHelper;
53390 exports.SkinnedMesh = SkinnedMesh;
53391 exports.Source = Source;
53392 exports.Sphere = Sphere;
53393 exports.SphereGeometry = SphereGeometry;
53394 exports.Spherical = Spherical;
53395 exports.SphericalHarmonics3 = SphericalHarmonics3;
53396 exports.SplineCurve = SplineCurve;
53397 exports.SpotLight = SpotLight;
53398 exports.SpotLightHelper = SpotLightHelper;
53399 exports.Sprite = Sprite;
53400 exports.SpriteMaterial = SpriteMaterial;
53401 exports.SrcAlphaFactor = SrcAlphaFactor;
53402 exports.SrcAlphaSaturateFactor = SrcAlphaSaturateFactor;
53403 exports.SrcColorFactor = SrcColorFactor;
53404 exports.StaticCopyUsage = StaticCopyUsage;
53405 exports.StaticDrawUsage = StaticDrawUsage;
53406 exports.StaticReadUsage = StaticReadUsage;
53407 exports.StereoCamera = StereoCamera;
53408 exports.StreamCopyUsage = StreamCopyUsage;
53409 exports.StreamDrawUsage = StreamDrawUsage;
53410 exports.StreamReadUsage = StreamReadUsage;
53411 exports.StringKeyframeTrack = StringKeyframeTrack;
53412 exports.SubtractEquation = SubtractEquation;
53413 exports.SubtractiveBlending = SubtractiveBlending;
53414 exports.TOUCH = TOUCH;
53415 exports.TangentSpaceNormalMap = TangentSpaceNormalMap;
53416 exports.TetrahedronGeometry = TetrahedronGeometry;
53417 exports.Texture = Texture;
53418 exports.TextureLoader = TextureLoader;
53419 exports.TorusGeometry = TorusGeometry;
53420 exports.TorusKnotGeometry = TorusKnotGeometry;
53421 exports.Triangle = Triangle;
53422 exports.TriangleFanDrawMode = TriangleFanDrawMode;
53423 exports.TriangleStripDrawMode = TriangleStripDrawMode;
53424 exports.TrianglesDrawMode = TrianglesDrawMode;
53425 exports.TubeGeometry = TubeGeometry;
53426 exports.TwoPassDoubleSide = TwoPassDoubleSide;
53427 exports.UVMapping = UVMapping;
53428 exports.Uint16BufferAttribute = Uint16BufferAttribute;
53429 exports.Uint32BufferAttribute = Uint32BufferAttribute;
53430 exports.Uint8BufferAttribute = Uint8BufferAttribute;
53431 exports.Uint8ClampedBufferAttribute = Uint8ClampedBufferAttribute;
53432 exports.Uniform = Uniform;
53433 exports.UniformsGroup = UniformsGroup;
53434 exports.UniformsLib = UniformsLib;
53435 exports.UniformsUtils = UniformsUtils;
53436 exports.UnsignedByteType = UnsignedByteType;
53437 exports.UnsignedInt248Type = UnsignedInt248Type;
53438 exports.UnsignedIntType = UnsignedIntType;
53439 exports.UnsignedShort4444Type = UnsignedShort4444Type;
53440 exports.UnsignedShort5551Type = UnsignedShort5551Type;
53441 exports.UnsignedShortType = UnsignedShortType;
53442 exports.VSMShadowMap = VSMShadowMap;
53443 exports.Vector2 = Vector2;
53444 exports.Vector3 = Vector3;
53445 exports.Vector4 = Vector4;
53446 exports.VectorKeyframeTrack = VectorKeyframeTrack;
53447 exports.VideoTexture = VideoTexture;
53448 exports.WebGL1Renderer = WebGL1Renderer;
53449 exports.WebGL3DRenderTarget = WebGL3DRenderTarget;
53450 exports.WebGLArrayRenderTarget = WebGLArrayRenderTarget;
53451 exports.WebGLCoordinateSystem = WebGLCoordinateSystem;
53452 exports.WebGLCubeRenderTarget = WebGLCubeRenderTarget;
53453 exports.WebGLMultipleRenderTargets = WebGLMultipleRenderTargets;
53454 exports.WebGLRenderTarget = WebGLRenderTarget;
53455 exports.WebGLRenderer = WebGLRenderer;
53456 exports.WebGLUtils = WebGLUtils;
53457 exports.WebGPUCoordinateSystem = WebGPUCoordinateSystem;
53458 exports.WireframeGeometry = WireframeGeometry;
53459 exports.WrapAroundEnding = WrapAroundEnding;
53460 exports.ZeroCurvatureEnding = ZeroCurvatureEnding;
53461 exports.ZeroFactor = ZeroFactor;
53462 exports.ZeroSlopeEnding = ZeroSlopeEnding;
53463 exports.ZeroStencilOp = ZeroStencilOp;
53464 exports._SRGBAFormat = _SRGBAFormat;
53465 exports.createCanvasElement = createCanvasElement;
53466 exports.sRGBEncoding = sRGBEncoding;
OpenLayers Projection transform
OpenLayers Util getParameters
OpenLayers Protocol Response
OpenLayers Bounds fromArray
OpenLayers Layer Google cache
OpenLayers INCHES_PER_UNIT degrees
OpenLayers Feature Vector style
OpenLayers Layer Google v2
OpenLayers Format XML document
OpenLayers Geometry Curve
OpenLayers Format WFST v1
THREE RGBA_S3TC_DXT3_Format
THREE ReverseSubtractEquation
THREE ArrowHelper prototype setLength
THREE Path prototype absellipse
THREE ShaderChunk envmap_vertex
THREE CurvePath prototype closePath
THREE Camera prototype lookAt
THREE LuminanceAlphaFormat
THREE MeshLambertMaterial
THREE PerspectiveCamera prototype setViewOffset
THREE Skeleton prototype pose
THREE ShaderChunk morphnormal_vertex
THREE ShaderChunk envmap_pars_vertex
THREE NearestMipMapNearestFilter
THREE Path prototype bezierCurveTo
THREE Curve prototype getUtoTmapping
THREE CurvePath prototype getCurveLengths
THREE ShaderChunk color_fragment
THREE ShaderChunk defaultnormal_vertex
THREE RGBA_S3TC_DXT1_Format
THREE ShaderChunk color_vertex
THREE ShaderChunk envmap_pars_fragment
THREE Bone prototype updateMatrixWorld
THREE CurvePath prototype getBoundingBox
THREE DefaultLoadingManager
THREE OneMinusSrcColorFactor
THREE ShaderChunk morphtarget_vertex
THREE IcosahedronGeometry
THREE SubtractiveBlending
THREE ShaderChunk logdepthbuf_pars_fragment
THREE Animation prototype stop
THREE Path prototype quadraticCurveTo
THREE ShaderChunk specularmap_pars_fragment
THREE ShaderChunk map_fragment
THREE ShaderChunk alphamap_pars_fragment
THREE Curve prototype getTangentAt
THREE ShaderChunk morphtarget_pars_vertex
THREE ShaderChunk skinbase_vertex
THREE ShaderChunk logdepthbuf_fragment
THREE LinearMipMapLinearFilter
THREE Triangle containsPoint
THREE OneMinusDstAlphaFactor
THREE Curve prototype getLengths
THREE Curve prototype getPointAt
THREE Mesh prototype updateMorphTargets
THREE ShaderChunk lightmap_fragment
THREE RGB_S3TC_DXT1_Format
THREE Camera prototype clone
THREE ShaderChunk lights_phong_pars_fragment
THREE QuadraticBezierCurve3
THREE ShaderChunk skinnormal_vertex
THREE ShaderChunk lightmap_pars_fragment
THREE DirectionalLightHelper prototype dispose
THREE ShaderChunk map_particle_pars_fragment
THREE UnsignedShort5551Type
THREE ShaderChunk color_pars_fragment
THREE PointCloud prototype raycast
THREE ShaderChunk skinning_pars_vertex
THREE ClampToEdgeWrapping
THREE ShaderChunk fog_pars_fragment
THREE Curve prototype getLength
THREE LinearMipMapNearestFilter
THREE Path prototype absarc
THREE ShaderChunk normalmap_pars_fragment
THREE ShaderChunk color_pars_vertex
THREE Curve prototype getPoint
THREE ShaderChunk alphatest_fragment
THREE ExtrudeGeometry prototype addShape
THREE ShaderChunk bumpmap_pars_fragment
THREE SkinnedMesh prototype bind
THREE ShaderChunk envmap_fragment
THREE NearestMipMapLinearFilter
THREE Sprite prototype updateMatrix
THREE ShaderChunk logdepthbuf_vertex
THREE Path prototype ellipse
THREE TetrahedronGeometry
THREE OrthographicCamera prototype updateProjectionMatrix
THREE ShaderChunk map_pars_fragment
THREE ShaderChunk worldpos_vertex
THREE Curve prototype getPoints
THREE ShaderChunk specularmap_fragment
THREE OneMinusDstColorFactor
THREE Path prototype splineThru
THREE Shape prototype getPointsHoles
THREE LOD prototype getObjectForDistance
THREE Path prototype lineTo
THREE ShaderChunk shadowmap_pars_fragment
THREE ShaderChunk alphamap_fragment
THREE JSONLoader prototype parse
THREE LOD prototype addLevel
THREE SkinnedMesh prototype normalizeSkinWeights
THREE Shape prototype extractPoints
THREE ShaderChunk fog_fragment
THREE SrcAlphaSaturateFactor
THREE ShaderChunk default_vertex
THREE Animation prototype reset
THREE ShaderChunk shadowmap_pars_vertex
THREE MirroredRepeatWrapping
THREE Curve prototype getSpacedPoints
THREE Curve prototype updateArcLengths
THREE UnsignedShort4444Type
THREE Curve prototype getTangent
THREE ShaderChunk map_particle_fragment
THREE RGBA_S3TC_DXT5_Format
THREE Path prototype moveTo
THREE ShaderChunk lights_phong_fragment
THREE ExtrudeGeometry WorldUVGenerator
THREE CubeReflectionMapping
THREE CubeRefractionMapping
THREE ShaderChunk logdepthbuf_pars_vertex
THREE ShaderChunk shadowmap_vertex
THREE OneMinusSrcAlphaFactor
THREE CurvePath prototype add
THREE QuadraticBezierCurve
THREE JSONLoader prototype load
THREE Skeleton prototype update
THREE RenderableVertex prototype copy
THREE ShaderChunk skinning_vertex
THREE Skeleton prototype calculateInverses